Changeset View
Changeset View
Standalone View
Standalone View
share/man/man3/pthread_cond_wait.3
| Show All 39 Lines | |||||
| .Sh DESCRIPTION | .Sh DESCRIPTION | ||||
| The | The | ||||
| .Fn pthread_cond_wait | .Fn pthread_cond_wait | ||||
| function atomically blocks the current thread waiting on the condition | function atomically blocks the current thread waiting on the condition | ||||
| variable specified by | variable specified by | ||||
| .Fa cond , | .Fa cond , | ||||
| and releases the mutex specified by | and releases the mutex specified by | ||||
| .Fa mutex . | .Fa mutex . | ||||
| The waiting thread unblocks only after another thread calls | The waiting thread unblocks after another thread calls | ||||
| .Xr pthread_cond_signal 3 , | .Xr pthread_cond_signal 3 , | ||||
| or | or | ||||
| .Xr pthread_cond_broadcast 3 | .Xr pthread_cond_broadcast 3 | ||||
| with the same condition variable, and the current thread reacquires the lock | with the same condition variable, and the current thread reacquires the lock | ||||
| on | on | ||||
| .Fa mutex . | .Fa mutex . | ||||
| .Pp | |||||
| It is possible that the | |||||
| .Fn pthread_cond_wait | |||||
| function returns without corresponding wakeup from either | |||||
marck: typo | |||||
| .Fn pthread_cond_signal | |||||
| or | |||||
| .Fn pthread_cond_broadcast . | |||||
| Such condition is called spurious wakeup, and is allowed by | |||||
| .St -p1003.1-96 . | |||||
| Applications should have a boolean expression used for each wait | |||||
| on the condition variable, and recheck it after return from the | |||||
| .Fn pthread_cond_wait | |||||
| function. | |||||
| .Sh RETURN VALUES | .Sh RETURN VALUES | ||||
| If successful, the | If successful, the | ||||
| .Fn pthread_cond_wait | .Fn pthread_cond_wait | ||||
| function will return zero. | function will return zero. | ||||
| Otherwise an error number will be returned to | Otherwise an error number will be returned to | ||||
| indicate the error. | indicate the error. | ||||
| .Sh ERRORS | .Sh ERRORS | ||||
| The | The | ||||
| Show All 37 Lines | |||||
typo