Suspends the thread until it receives a post or times out.
Standard C library (libc.a)
#include <sys/thread.h>
int thread_wait( timeout)
int timeout;
The thread_wait subroutine allows a thread to wait or block until another thread posts it with the thread_post or the thread_post_many subroutine or until the time limit specified by the timeout value expires. It returns immediately if there is a pending post for this thread or if a timeout value of 0 is specified.
If the event for which the thread is waiting and for which it will be posted will occur only in the future, the thread_wait subroutine may be called with a timeout value of 0 to clear any pending posts.
The thread_wait and the thread_post subroutine can be used by applications to implement a fast IPC mechanism between threads in different processes.
On successful completion, the thread_wait subroutine returns a value of 0. The thread_wait subroutine completes successfully if there was a pending post or if the calling thread was posted before the time limit specified by the timeout parameter expires.
A return value of THREAD_WAIT_TIMEDOUT indicates that the thread_wait subroutine timed out.
If unsuccessful, a value of -1 is returned and the global variable errno is set to indicate the error.
The thread_wait subroutine is unsuccessful when one of the
following is true:
EINTR | This subroutine was terminated by receipt of a signal. |
ENOMEM | There is not enough memory to allocate a timer |
The thread_post (thread_post Subroutine) subroutine, and thread_post_many (thread_post_many Subroutine) subroutine.