Index of Section 2 Manual Pages
| Interix / SUA | pthread_cond_signal.2 | Interix / SUA |
pthread_cond_signal(2) pthread_cond_signal(2)
pthread_cond_broadcast()
NAME
pthread_cond_broadcast(), pthread_cond_signal() - unblock one or more
threads
SYNOPSIS
#include
int pthread_cond_broadcast(pthread_cond_t *cond);
int pthread_cond_signal(pthread_cond_t *cond);
DESCRIPTION
The pthread_cond_broadcast(2) function unblocks all threads that are
blocked on the condition variable specified by the cond argument.
The pthread_cond_signal(2) function unblocks one or more threads that are
blocked on the condition variable specified by cond, if any.
If multiple threads are blocked on the condition variable, the thread's
scheduling policy determines the order in which the threads are unblocked.
Each thread that is unblocked by a call to pthread_cond_broadcast() or
pthread_cond_signal() owns the mutex with which it called
pthread_cond_timedwait(2) or pthread_cond_wait(2) after returning from
that function call. The thread or threads that are unblocked contend for
the mutex according to the scheduling policy, if applicable, as though
each thread had called pthread_mutex_lock(2).
A thread can call pthread_cond_broadcast() or pthread_cond_signal()
regardless of whether the thread owns the mutex that threads that have
called pthread_cond_timedwait() or pthread_cond_wait() associated with the
condition variable during their waits. To provide for predictable
scheduling behavior, the mutex can be locked by the thread calling
pthread_cond_broadcast() or pthread_cond_signal().
If no threads are blocked on the condition variable specified by cond, the
pthread_cond_broadcast() or pthread_cond_signal() functions have no
effect.
RETURN VALUES
On success, both functions return 0; otherwise, an error code is returned.
ERRORS
Both functions can fail for the following reason:
[EINVAL]
The value specified by the cond argument is not an initialized
condition variable.
This function does not return [EINTR].
SEE ALSO
pthread_cond_destroy(2)
pthread_cond_timedwait(2)
USAGE NOTES
All of these functions are thread safe.
None of these functions are async-signal safe.