.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/lib/libc_r/man/pthread_cond_wait.3,v 1.8.2.4 2001/08/17 15:42:51 ru Exp $
+.\" $FreeBSD$
.\"
-.Dd November 5, 2001
+.Dd February 16, 2006
.Dt PTHREAD_COND_WAIT 3
.Os Darwin
.Sh NAME
.Nm pthread_cond_wait
.Nd wait on a condition variable
.Sh SYNOPSIS
-.Fd #include <pthread.h>
+.In pthread.h
.Ft int
-.Fo pthread_cond_wait
-.Fa "pthread_cond_t *restrict cond"
-.Fa "pthread_mutex_t *restrict mutex"
-.Fc
+.Fn pthread_cond_wait "pthread_cond_t *cond" "pthread_mutex_t *mutex"
.Sh DESCRIPTION
The
.Fn pthread_cond_wait
-function atomically unlocks the
-.Fa mutex
-and blocks the current thread on the condition specified by the
-.Fa cond
-argument.
-The current thread unblocks only after another thread calls
-.Xr pthread_cond_signal 3
+function atomically blocks the current thread waiting on the condition
+variable specified by
+.Fa cond ,
+and releases the mutex specified by
+.Fa mutex .
+The waiting thread unblocks only after another thread calls
+.Xr pthread_cond_signal 3 ,
or
.Xr pthread_cond_broadcast 3
-with the same condition variable.
-The
-.Fa mutex
-must be locked before calling this function, otherwise the behavior is
-undefined. Before
-.Fn pthread_cond_wait
-returns to the calling function, it re-acquires the
+with the same condition variable, and the current thread reacquires the lock
+on
.Fa mutex .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_wait
-function will return zero; otherwise, an error number will be returned to
+function will return zero.
+Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
+The
.Fn pthread_cond_wait
-will fail if:
+function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Xr pthread_cond_signal 3 ,
.Xr pthread_cond_timedwait 3
.Sh STANDARDS
+The
.Fn pthread_cond_wait
-conforms to
+function conforms to
.St -p1003.1-96 .