Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_sleepon_signal.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_sleepon_signal.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_sleepon_signal.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_sleepon_signal.html on line 8

pthread_sleepon_signal()

Signal a sleeping thread

Synopsis:

#include <pthread.h>

int pthread_sleepon_signal(
       const volatile void * addr );

Arguments:

addr
The handle that the threads are waiting on. The value of addr is typically a data structure that controls a resource.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_sleepon_signal() function unblocks the highest priority thread waiting on addr.

You should use pthread_sleepon_broadcast() or pthread_sleepon_signal(), depending on the task you're doing:

Mapping a single predicate to one address
Use pthread_sleepon_signal().

If you use pthread_sleepon_broadcast(), you must recheck the predicate and reblock if necessary. The first thread to wake up owns the lock; all others must go back to sleep.

If you use pthread_sleepon_signal(), you don't have to recheck the predicate. One thread owns the lock at a time.

Mapping multiple predicates to one address
You need to use pthread_sleepon_broadcast() to wake up all blocked threads. You must recheck the predicates and reblock if necessary. You should try to map only one predicate to one address.

Don't use pthread_sleepon_signal() in this case; it could result in a deadlock.

Returns:

EOK
Success.
EINVAL
Invalid sleepon address.

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

pthread_cond_signal(), pthread_sleepon_broadcast(), pthread_sleepon_lock(), pthread_sleepon_unlock(), pthread_sleepon_wait()

Processes and Threads chapter of Getting Started with QNX Neutrino


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_sleepon_signal.html on line 160

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_sleepon_signal.html on line 160