Page Speed Optimization Libraries
1.13.35.1
|
#include "condvar.h"
Public Member Functions | |
virtual CondvarCapableMutex * | mutex () const =0 |
Return the mutex associated with this condition variable. | |
virtual void | Signal ()=0 |
virtual void | Broadcast ()=0 |
virtual void | Wait ()=0 |
virtual void | TimedWait (int64 timeout_ms)=0 |
Abstract interface for implementing a condition variable layered on top of a given mutex type, which ought to extend CondvarCapableMutex.
|
pure virtual |
Broadcast to all threads waiting on condvar. mutex() must be held as with Signal().
Implemented in net_instaweb::NullCondvar, and net_instaweb::PthreadCondvar.
|
pure virtual |
Signal the condvar, waking a waiting thread if any. mutex() must be held by caller. Example: { ScopedMutex lock(cv.mutex()); make_resource_available(); cv.Signal(); }
Implemented in net_instaweb::NullCondvar, and net_instaweb::PthreadCondvar.
|
pure virtual |
Wait for condition to be signaled, or timeout to occur. Works like Wait(), and cv.mutex() must be held on entry and re-taken on exit.
Implemented in net_instaweb::NullCondvar, and net_instaweb::PthreadCondvar.
|
pure virtual |
Wait for condition to be signaled. mutex() must be held; it will be released and then reclaimed when a signal is received. Note that a Wait() may be terminated based on a condition being true, but the condition may no longer be true at the time the thread wakes up. Example: { ScopedMutex lock(cv.mutex()); while (status && !resource_available()) status = cv.wait(); if (status) { use_resource(); } }
Implemented in net_instaweb::NullCondvar, and net_instaweb::PthreadCondvar.