Public Member Functions | |
virtual | ~NamedLock () |
Destructors of extending classes must unlock the lock if held on destruct. | |
virtual bool | TryLock ()=0 |
virtual bool | LockTimedWait (int64 wait_ms)=0 |
Wait bounded amount of time to take lock, otherwise return false. | |
virtual void | LockTimedWait (int64 wait_ms, Function *callback)=0 |
virtual bool | TryLockStealOld (int64 timeout_ms)=0 |
virtual bool | LockTimedWaitStealOld (int64 wait_ms, int64 timeout_ms)=0 |
virtual void | LockTimedWaitStealOld (int64 wait_ms, int64 timeout_ms, Function *callback)=0 |
virtual void | Unlock ()=0 |
Relinquish lock. Non-blocking. | |
virtual bool | Held ()=0 |
Returns true if this lock is held by this particular lock object. | |
virtual GoogleString | name ()=0 |
The name the lock was created with, for debugging/logging purposes. |
virtual void net_instaweb::NamedLock::LockTimedWait | ( | int64 | wait_ms, | |
Function * | callback | |||
) | [pure virtual] |
Return immediately. Wait wait_ms to take lock, invoke callback with lock held. On timeout, cancel callback.
Implemented in net_instaweb::SchedulerBasedAbstractLock.
virtual void net_instaweb::NamedLock::LockTimedWaitStealOld | ( | int64 | wait_ms, | |
int64 | timeout_ms, | |||
Function * | callback | |||
) | [pure 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.
Implemented in net_instaweb::SchedulerBasedAbstractLock.
virtual bool net_instaweb::NamedLock::LockTimedWaitStealOld | ( | int64 | wait_ms, | |
int64 | timeout_ms | |||
) | [pure virtual] |
LockTimedWaitStealOld will block until unlocked, the lock has been held for timeout_ms, or the caller has waited for wait_ms.
Implemented in net_instaweb::SchedulerBasedAbstractLock.
virtual bool net_instaweb::NamedLock::TryLock | ( | ) | [pure virtual] |
If lock is held, return false, otherwise lock and return true. Non-blocking. Note that implementations of this and other similar 'try' routines are permitted to return false conservatively. TryLock must eventually* succeed if called repeatedly on an unheld lock, however.
virtual bool net_instaweb::NamedLock::TryLockStealOld | ( | int64 | timeout_ms | ) | [pure virtual] |
...StealOld versions of locking routines steal the lock if its current holder has locked it for more than timeout_ms. *WARNING* If you use any ...StealOld methods, your lock becomes "best-effort" and there may be multiple workers in a critical section! *WARNING* TryLockStealOld immediately attempts to lock the lock, succeeding and returning true if the lock is unlocked or the lock can be stolen from the current holder. Otherwise return false. cf TryLock() for other caveats. Non-blocking.