Print this page
12309 errors in section 9e of the manual
@@ -42,16 +42,15 @@
.\"
.\" Portions Copyright (c) 1995 IEEE. All Rights Reserved.
.\" Copyright (c) 2001, The IEEE and The Open Group. All Rights Reserved.
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\"
-.TH COND_INIT 3C "Jun 5, 2007"
+.TH COND_INIT 3C "February 15, 2020"
.SH NAME
cond_init, cond_wait, cond_timedwait, cond_reltimedwait, cond_signal,
cond_broadcast, cond_destroy \- condition variables
.SH SYNOPSIS
-.LP
.nf
cc -mt [ \fIflag\fR... ] \fIfile\fR... [ \fIlibrary\fR... ]
#include <thread.h>
#include <synch.h>
@@ -90,12 +89,10 @@
\fBint\fR \fBcond_destroy\fR(\fBcond_t *\fR\fIcvp\fR);
.fi
.SH DESCRIPTION
.SS "Initialize"
-.sp
-.LP
Condition variables and mutexes should be global. Condition variables that are
allocated in writable memory can synchronize threads among processes if they
are shared by the cooperating processes (see \fBmmap\fR(2)) and are initialized
for this purpose.
.sp
@@ -197,12 +194,10 @@
inter-process scope */
.fi
.in -2
.SS "Condition Wait"
-.sp
-.LP
The condition wait interface allows a thread to wait for a condition and
atomically release the associated mutex that it needs to hold to check the
condition. The thread waits for another thread to make the condition true and
that thread's resulting call to signal and wakeup the waiting thread.
.sp
@@ -220,12 +215,10 @@
attribute and has been left irrecoverable by the mutex's last owner. The
\fBcond_wait()\fR, \fBcond_timedwait()\fR, and \fBcond_reltimedwait()\fR
functions return the appropriate error value if they fail to internally
reacquire the mutex.
.SS "Condition Signaling"
-.sp
-.LP
A condition signal allows a thread to unblock a single thread waiting on the
condition variable, whereas a condition broadcast allows a thread to unblock
all threads waiting on the condition variable.
.sp
.LP
@@ -246,27 +239,21 @@
\fBcond_wait()\fR, \fBcond_timedwait()\fR, or \fBcond_reltimedwait()\fR have
associated with the condition variable during their waits. If, however,
predictable scheduling behavior is required, then that mutex should be locked
by the thread prior to calling \fBcond_signal()\fR or \fBcond_broadcast()\fR.
.SS "Destroy"
-.sp
-.LP
The condition destroy functions destroy any state, but not the space,
associated with the condition variable.
.sp
.LP
The \fBcond_destroy()\fR function destroys any state associated with the
condition variable pointed to by \fIcvp\fR. The space for storing the condition
variable is not freed.
.SH RETURN VALUES
-.sp
-.LP
Upon successful completion, these functions return \fB0\fR. Otherwise, a
non-zero value is returned to indicate the error.
.SH ERRORS
-.sp
-.LP
The \fBcond_timedwait()\fR and \fBcond_reltimedwait()\fR functions will fail
if:
.sp
.ne 2
.na
@@ -340,15 +327,14 @@
For \fBcond_timedwait()\fR, the number of nanoseconds is greater than or equal
to 1,000,000,000.
.RE
.SH EXAMPLES
-.LP
\fBExample 1 \fRUse \fBcond_wait()\fR in a loop to test some condition.
.sp
.LP
-The \fBcond_wait()\fR functin is normally used in a loop testing some
+The \fBcond_wait()\fR function is normally used in a loop testing some
condition, as follows:
.sp
.in +2
.nf
@@ -411,12 +397,10 @@
(void) mutex_unlock(mp);
.fi
.in -2
.SH ATTRIBUTES
-.sp
-.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
@@ -427,18 +411,14 @@
_
MT-Level MT-Safe
.TE
.SH SEE ALSO
-.sp
-.LP
\fBfork\fR(2), \fBmmap\fR(2), \fBsetitimer\fR(2), \fBshmop\fR(2),
\fBmutex_init\fR(3C), \fBsignal\fR(3C), \fBattributes\fR(5),
\fBcondition\fR(5), \fBmutex\fR(5), \fBstandards\fR(5)
.SH NOTES
-.sp
-.LP
If more than one thread is blocked on a condition variable, the order in which
threads are unblocked is determined by the scheduling policy. When each thread,
unblocked as a result of a \fBcond_signal()\fR or \fBcond_broadcast()\fR,
returns from its call to \fBcond_wait()\fR or \fBcond_timedwait()\fR , the
thread owns the mutex with which it called \fBcond_wait()\fR,