Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
net_instaweb::ThreadSystem::Condvar Class Referenceabstract

#include "condvar.h"

Inheritance diagram for net_instaweb::ThreadSystem::Condvar:
net_instaweb::NullCondvar net_instaweb::PthreadCondvar

Public Member Functions

virtual CondvarCapableMutexmutex () 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
 

Detailed Description

Abstract interface for implementing a condition variable layered on top of a given mutex type, which ought to extend CondvarCapableMutex.

Member Function Documentation

virtual void net_instaweb::ThreadSystem::Condvar::Broadcast ( )
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.

virtual void net_instaweb::ThreadSystem::Condvar::Signal ( )
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.

virtual void net_instaweb::ThreadSystem::Condvar::TimedWait ( int64  timeout_ms)
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.

virtual void net_instaweb::ThreadSystem::Condvar::Wait ( )
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.


The documentation for this class was generated from the following file: