On Wed, May 10, 2000 at 07:59:16AM +0200, Tobias Klotz wrote:
> Is it not recommend to use pthread_wakeup_np form inside an ISR?`(I
> currently do
> it and I'm not sure if it is a good idea, what makes the difference?).

pthread_wakeup_np and pthread_suspend_np both call the scheduler 
(if the target thread is on the same machine) so the ISR may
not complete right away -- which is sometimes exactly what you want.
Here's an example:

       Re_entrant_ISR:
            do low level stuff
            make sure to re-enable hard interrupts from this source
            /* which thread did we interrupt? Is it the target?*/
            if(pthread_self() == my_thread){
                   /* give up the processor at once */
                     pthread_suspend_np(pthread_self())
                     return; /*after thread wakes up again */
                    }
             else {
                  /* just make sure thread does not get scheduled again*/
                    pthread_kill(my_thread,RTL_SIG_SUSPEND);
                    return; /* scheduler is not called yet */
                    }

> 
> Which header do I have to include to use pthread_kill ?
> 

Just use 2.2 or later.


> Thanks
> 
> tobias
> 
> [EMAIL PROTECTED] schrieb:
> 
> > On Tue, May 09, 2000 at 10:12:43AM -0500, daniel sheltraw wrote:
> > > I have setup an ISR that accepts hardware interrupts from another
> > > device via the parallel port. The ISR simply increments a counter. I
> would
> > > like to produce a pause in the task when the counter reaches a
> certain value
> > > and restart the task at another counter value. This
> > > should be done without a busy wait checking the value of the
> counter.
> >
> > Here's on way.
> > /* note that if "thread" is running when the SUSPEND is sent, it
> >    will continue to run until it times out or calls the scheduler */
> >
> > interrupt_handler:
> >          count++;
> >          if(should_stop(count))
> >                  pthread_kill(thread,RTL_SIG_SUSPEND);
> >          else if(should_restart(count))
> >                  pthread_kill(thread,RTL_SIG_WAKEUP);
> >
> >
> > >
> > > Any clarifications on using suspend/resume routines to control the
> task
> > > within an ISR. Any other suggestions? Semaphores were
> > > suggested. Does anyone have a code snippet for a semaphore approach?
> 
> > >
> > > Thanks everyone,
> > > Daniel
> > >
> > >
> > > >From: [EMAIL PROTECTED]
> > > >To: [EMAIL PROTECTED]
> > > >CC: [EMAIL PROTECTED]
> > > >Subject: Re: [rtl] RT interrupt service routine question
> > > >Date: Tue, 09 May 2000 16:31:47 +0200 (MET DST)
> > > >
> > > >
> > > > > > pthread_wakeup_np() is safe. The others are unknown (yet).
> > > > >
> > > > > pthread_suspend_np  is safe, but may suspend the interrupt
> handler.
> > > >
> > > >Folks,
> > > >
> > > >"Safe" just means: it won't crash your machine (immediately).
> > > >It not equal to "useful" or "wise".  ;-)
> > > >
> > > >
> > > >Gabor
> > > >-- [rtl] ---
> > > >To unsubscribe:
> > > >echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > > >echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > > >---
> > > >For more information on Real-Time Linux see:
> > > >http://www.rtlinux.org/rtlinux/
> > > >
> > >
> > >
> ________________________________________________________________________
> 
> > > Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com
> > >
> > > -- [rtl] ---
> > > To unsubscribe:
> > > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > > ---
> > > For more information on Real-Time Linux see:
> > > http://www.rtlinux.org/rtlinux/
> >
> > --
> > ---------------------------------------------------------
> > Victor Yodaiken
> > FSMLabs:  www.fsmlabs.com  www.rtlinux.com
> > FSMLabs is a servicemark and a service of
> > VJY Associates L.L.C, New Mexico.
> >
> > -- [rtl] ---
> > To unsubscribe:
> > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > ---
> > For more information on Real-Time Linux see:
> > http://www.rtlinux.org/rtlinux/
> 
> 
> 
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> ---
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/

-- 
---------------------------------------------------------
Victor Yodaiken 
FSMLabs:  www.fsmlabs.com  www.rtlinux.com
FSMLabs is a servicemark and a service of 
VJY Associates L.L.C, New Mexico.

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to