On Tue, Jun 20, 2000 at 11:30:39AM -0400, Stephen D. Cohen wrote:
> Victor Et. Al.,
> 
>       You recently wrote:
> 
> > 1. Saving fp state is _slow_ so  you don't need it in an ISR 
> > -- there is no performance loss
> >        in having the ISR hand over work to a thread.
> 
>       I have been trying to figure out how to do this for some time.
> Would you please provide a code fragment or clear explanation of how to have
> an ISR cause a thread to become computable?


There are several methods. The simplest is to have a thread suspend itself
and then have the ISR send a signal

thread:
      isr_ran = 0;
      do something
      thread_to_wakeup = pthread_self();
      rtl_no_interrupts(flag); /* make sure I don't miss the 
                                 wakeup */
      if(!wakeup_sent)rtl_suspend_np(pthread_self());
     /* hey the ISR woke me up */
     do something else



ISR_catch_interrupt:
       
       if(thread_to_wakeup)pthread_kill(thread_to_wakeup,RTL_SIG_WAKEUP);
       isr_ran  = 1;
        
    
       
> 
>       I thought it would be correct to simply have the thread sleep until
> it gets woken up by the ISR, but I am told that this will cause the thread
> to run in the ISR context.  That is, obviously, not what we want.  I want to

Only if you do a pthread_wakeup_np(thread) of a higher priority
thread.

> get in and out of ISR context just as quickly as possible, but cause another
> thread to become computable (a high priority hardware handler responding to
> the interrupt, for example).
> 
>       Any suggestions?
> 
> Confusedly Yours,
> 
> Steve
> 
> P.S. ->
> > 3. Rare workarounds are better than rarely used features.  
> > Keeping the API simple is 
> >    critical.
> 
>       I could not agree more.

You are, I see, a man of taste and perception. 

-- [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