The Cond class
Cond
&reftitle.intro;
The following paragraph is taken from the Posix Thread documentation to explain the purpose of Condition Variables:
Condition variables provide yet another way for threads to synchronize. While mutexes implement synchronization by controlling thread access to data, condition variables allow threads to synchronize based upon the actual value of data.
Without condition variables, the programmer would need to have threads continually polling (possibly in a critical section), to check if the condition is met. This can be very resource consuming since the thread would be continuously busy in this activity. A condition variable is a way to achieve the same goal without polling.
A condition variable is always used in conjunction with a mutex lock.
pthreads provides PHP with direct acces to a carefully selected subset of Condition Variable functions.
Because of their nature, the programmer must take care to destroy Condition Variable handles they are finished with.
&reftitle.classsynopsis;
Cond
Cond
&Methods;
&reference.pthreads.entities.cond;