pthread_wakeup_np

Name

pthread_wakeup_np -- wake up a realtime thread.

Synopsis

       #include <rtl_sched.h>

       int pthread_wakeup_np(pthread_t thread);

DESCRIPTION

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

RETURN VALUE

Always returns 0.

ERRORS

None.

NOTES

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.)

AUTHOR

Michael Barabanov and Victor Yodaiken (support@fsmlabs.com)

SEE ALSO

pthread_suspend_np(3), pthread_make_periodic_np(3), pthread_wait_np(3)

©2001 FSMLabs Inc.

All rights reserved.