[Previous] [Contents] [Next]

pthread_sleepon_signal()

Signal a sleeping thread

Synopsis:

#include <pthread.h>

int pthread_sleepon_signal( const volatile void * addr );

Library:

libc

Description:

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

Here's a table to help you decide when to use pthread_sleepon_broadcast() or pthread_sleepon_signal():

Task pthread_sleepon_broadcast() pthread_sleepon_signal()
Mapping a single predicate to one address. You must recheck the predicate and reblock if necessary. See pthread_sleepon_signal() for a better implementation.

The first thread to wake up owns the lock, all others must go back to sleep.

This is the correct and efficient use of pthread_sleepon_signal(). You must recheck the predicate.

One thread owns the lock at a time.

Mapping multiple predicates to one address. The pthread_sleepon_broadcast() function is necessary 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 6

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


[Previous] [Contents] [Next]