man pthread_wakeup_np () - wake up a realtime thread.


pthread_wakeup_np - wake up a realtime thread.


#include <rtl_sched.h> 
int pthread_wakeup_np(pthread_t thread); 


This function is a non-portable Realtime Linux extension. pthread_wakeup_np wakes up the realtime thread thread.


Always returns 0.




This function is safe to call from interrupt handlers and threads, but not from the Linux kernel. Calling the function will cause a thread switch if the awakened thread is higher priority than the current thread and they are both on the same processor. In this case, pthread_wakeup called from an interrupt handler will suspend the current thread at once. The handler will complete when there are no more runnable higher priority threads.

To illustrate, suppose we want to have very simple interrupt handlers (always a good idea), but we need complex processing done after each interrupt. We can designate a thread to do this processing and give it the highest priority. Then the interrupt handlers may push some data into a queue and call pthread_wakeup, to wake up the thread and switch to it at once. (WARNING: Do not leave any critical hardware handshaking until after the return from pthread_wakeup_np, unless it is okay for the handshaking to be postponed until the interrupted thread is scheduled again.)


Michael Barabanov and Victor Yodaiken ( (link to URL )


pthread_suspend_np(3) (link to URL pthread_suspend_np.3.html) , pthread_make_periodic_np(3) (link to URL pthread_make_periodic_np.3.html) , pthread_wait_np(3) (link to URL pthread_wait_np.3.html)

©2001 FSMLabs Inc.

All rights reserved.