Standard C Library Functions pthreadcondsignal(3C)
NAME
pthreadcondsignal, pthreadcondbroadcast - signal or
broadcast a condition
SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ]
#include
int pthreadcondsignal(pthreadcondt *cond);
int pthreadcondbroadcast(pthreadcondt *cond);
DESCRIPTION
These two functions are used to unblock threads blocked on a
condition variable.
The pthreadcondsignal() call unblocks at least one of the
threads that are blocked on the specified condition variable
cond (if any threads are blocked on cond).
The pthreadcondbroadcast() call unblocks all threads
currently blocked on the specified condition variable cond.
If more than one thread is blocked on a condition variable,
the scheduling policy determines the order in which threads
are unblocked. When each thread unblocked as a result of a
pthreadcondsignal() or pthreadcondbroadcast() returns
from its call to pthreadcondwait() or
pthreadcondtimedwait(), the thread owns the mutex with
which it called pthreadcondwait() or
pthreadcondtimedwait(). The thread(s) that are unblocked
contend for the mutex according to the scheduling policy (if
applicable), and as if each had called pthreadmutexlock().
The pthreadcondsignal() or pthreadcondbroadcast() func-
tions may be called by a thread whether or not it currently
owns the mutex that threads calling pthreadcondwait() or
pthreadcondtimedwait() have associated with the condition
variable during their waits; however, if predictable
scheduling behavior is required, then that mutex is locked
by the thread calling pthreadcondsignal() or
pthreadcondbroadcast().
The pthreadcondsignal() and pthreadcondbroadcast() func-
tions have no effect if there are no threads currently
SunOS 5.11 Last change: 23 Mar 2005 1
Standard C Library Functions pthreadcondsignal(3C)
blocked on cond.
RETURN VALUES
If successful, the pthreadcondsignal() and
pthreadcondbroadcast() functions return 0. Otherwise, an
error number is returned to indicate the error.
ERORS
The pthreadcondsignal() and pthreadcondbroadcast()
function may fail if:
EINVAL The value cond does not refer to an initialized
condition variable.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Standard
MT-Level MT-Safe
SEE ALSO
pthreadcondinit(3C), pthreadcondwait(3C),
pthreadcondtimedwait(3C), attributes(5), condition(5),
standards(5)
SunOS 5.11 Last change: 23 Mar 2005 2
|