Page Speed Optimization Libraries
1.2.24.1
|
#include "scheduler_based_abstract_lock.h"
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 Scheduler * | scheduler () const =0 |
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).
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 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.
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.