PTHREAD_COND_BROADCAST(3)

NAME
pthread_cond_broadcast, pthread_cond_signal - unblock one or all threads waiting on a condition variable

LIBRARY
libpthread

SYNOPSIS
#include <pthread.h>
int
pthread_cond_broadcast(pthread_cond_t *cond);
int
pthread_cond_signal(pthread_cond_t *cond);

DESCRIPTION
The pthread_cond_broadcast() function unblocks all threads waiting for the condition variable cond. If no threads are waiting on cond, the pthread_cond_broadcast() function has no effect.

The pthread_cond_signal() function unblocks one thread waiting for the condition variable cond. If no threads are waiting on cond, the pthread_cond_signal() function has no effect.

When calling pthread_cond_wait() and/or pthread_cond_timedwait(), a temporary binding is established between the condition variable cond and a caller-supplied mutex.

The same mutex must be held while calling pthread_cond_broadcast() and pthread_cond_signal(). Neither function enforces this requirement, but if the mutex is not held the resulting behaviour is undefined.

RETURN VALUES
If successful, the pthread_cond_broadcast() and pthread_cond_signal() functions will return zero, otherwise an error number will be returned to indicate the error.

ERRORS
pthread_cond_broadcast() and pthread_cond_signal() may fail if:

[EINVAL]
    The value specified by cond is invalid.

SEE ALSO
pthread_cond_destroy(3), pthread_cond_init(3), pthread_cond_timedwait(3), pthread_cond_wait(3)

STANDARDS
pthread_cond_broadcast() and pthread_cond_signal() conform to p1003.1-96.