Hardware Reference
In-Depth Information
Error
Description
EAGAIN
The system lacked the necessary resources.
ENOMEM
Insufficient memory exists to initialize the condition variable.
EBUSY
The implementation has detected an attempt to reinitialize the object
referenced by cond, a previously initialized, but not yet destroyed,
condition variable.
EINVAL
The value specified by attr is invalid.
pthread_cond_destroy(3)
When a condition ( cond ) variable is no longer required, its resources should be released
with the following call:
int pthread_cond_destroy(pthread_cond_t
cond);
cond : Condition variable to be released.
returns : Zero if the call was successful; otherwise, returns an
error code (not in errno ).
Error
Description
EBUSY
Detected an attempt to destroy the object referenced by cond while it
is referenced by pthread_cond_wait() or pthread_cond_timedwait() in
another thread.
EINVAL
The value specified by cond is invalid.
pthread_cond_wait(3)
This function is one-half of the queue solution. The pthread_cond_wait(3) function is
called with the mutex already locked. The kernel will then put the calling thread to sleep
(on the wait queue) to release the CPU, while at the same time unlocking the mutex. The
calling thread remains blocked until the condition variable cond is signaled in some way
(more about that later).
When the thread is awakened by the kernel, the system call returns with the mutex
locked. At this point, the thread can check the application condition (like queue length)
and then proceed if things are favorable, or call pthread_cond_wait(3) again to wait
further.
int pthread_cond_wait(
pthread_cond_t *cond,
pthread_mutex_t *mutex
);
 
 
Search WWH ::




Custom Search