_sleepon_wait()

Wait on a sleepon lock

Synopsis:

#include <pthread.h>

int _sleepon_wait( sleepon_t * l, 
                   const volatile void * addr,
                   uint64_t nsec);

Arguments:

l
A pointer to a sleepon_t that you created by calling _sleepon_init().
addr
The handle that you want to wait on. The value of addr is typically a data structure that controls a resource.
nsec
Zero, or the amount of time, in nanoseconds, to wait before the thread wakes up. If this timeout occurs, ETIMEDOUT is returned.

Library:

libc

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

Description:

The _sleepon_wait() function blocks on the sleepon l using the key addr until woken up by either a _sleepon_signal() or a _sleepon_broadcast() call that uses the same addr key.

The calling thread must first have locked the sleepon by calling _sleepon_lock().

When the thread returns from this function, it must release the sleepon lock by calling _sleepon_unlock().

Returns:

0
Success.
≠0
Failure; a nonzero errno value.

Classification:

QNX Neutrino

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

See also:

_sleepon_broadcast(), _sleepon_lock(), _sleepon_unlock(), _sleepon_signal()