Block a thread on a conditional variable
int PtCondWait( pthread_cond_t *cond );
ph
PtCondWait() is an equivalent of pthread_cond_wait() that uses the Photon library lock instead of a mutex, which has the effect of an implicit PtLeave() when you block, and PtEnter() when you unblock.
The calling thread is blocked until:
Or:
In all cases, the thread reacquires the Photon library lock before being unblocked.
The implicit PtLeave() call that PtCondWait() makes before blocking turns the calling thread into an event non-reader. If you passed the Pt_DELAY_EXIT flag to PtEnter() before calling PtCondWait(), it also disables the effect of that flag. Before returning, PtCondWait() turns the thread back into an event reader if it was an event reader before, but will not turn the Pt_DELAY_EXIT flag back on. In particular, this means that if another thread has called PtExit(), this function does not return, even if a third thread signals the condvar.
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
PtCondTimedWait(), PtEnter(), PtLeave()
pthread_cond_wait() in the QNX Neutrino Library Reference
“Threads” in the Parallel Operations chapter of the Photon Programmer's Guide