net_instaweb::SchedulerBasedAbstractLock Class Reference

#include "scheduler_based_abstract_lock.h"

Inheritance diagram for net_instaweb::SchedulerBasedAbstractLock:
net_instaweb::NamedLock

List of all members.

Public Member Functions

virtual bool LockTimedWait (int64 wait_ms)
 Wait bounded amount of time to take lock, otherwise return false.
virtual void LockTimedWait (int64 wait_ms, Function *callback)
virtual bool LockTimedWaitStealOld (int64 wait_ms, int64 steal_ms)
virtual void LockTimedWaitStealOld (int64 wait_ms, int64 steal_ms, Function *callback)

Protected Member Functions

virtual Schedulerscheduler () const =0

Detailed Description

A SchedulerBasedAbstractLock implements a Lock by blocking using the scheduler, using exponential sleep time backoff and polling the lock on wakeup. The total time blocked on a long-held lock will be about 1.5 times the time between the initial call to the lock routine attempt and the time the lock is unlocked (ie we might wait for an extra amount of time equal to half the time we were forced to wait).


Member Function Documentation

virtual void net_instaweb::SchedulerBasedAbstractLock::LockTimedWait ( int64  wait_ms,
Function callback 
) [virtual]

Return immediately. Wait wait_ms to take lock, invoke callback with lock held. On timeout, cancel callback.

Implements net_instaweb::NamedLock.

virtual void net_instaweb::SchedulerBasedAbstractLock::LockTimedWaitStealOld ( int64  wait_ms,
int64  timeout_ms,
Function callback 
) [virtual]

Return immeidately. Run the callback if the lock can be obtained within wait_ms, seizing the lock if the current holder has held it more than timeout_ms. On timeout, cancel callback.

Implements net_instaweb::NamedLock.

virtual bool net_instaweb::SchedulerBasedAbstractLock::LockTimedWaitStealOld ( int64  wait_ms,
int64  timeout_ms 
) [virtual]

LockTimedWaitStealOld will block until unlocked, the lock has been held for timeout_ms, or the caller has waited for wait_ms.

Implements net_instaweb::NamedLock.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Tue May 29 16:34:16 2012 for Page Speed Optimization Libraries by  doxygen 1.6.3