Page Speed Optimization Libraries
1.13.35.1
|
Non-blocking locking class. More...
#include "named_lock_manager.h"
Public Member Functions | |
virtual | ~NamedLock () |
Destructors of extending classes must unlock the lock if held on destruct. | |
virtual void | LockTimedWait (int64 wait_ms, Function *callback)=0 |
virtual void | LockTimedWaitStealOld (int64 wait_ms, int64 steal_ms, Function *callback)=0 |
virtual void | Unlock ()=0 |
virtual bool | Held ()=0 |
virtual GoogleString | name () const =0 |
The name the lock was created with, for debugging/logging purposes. | |
Non-blocking locking class.
|
pure virtual |
Returns true if this lock is held by this particular lock object.
Note: in some implementations Held() may remain true until Unlock regardless if another lock steals.
Implemented in net_instaweb::MemLock.
|
pure virtual |
Attempts to take a lock. callback->Run() is called if the lock was granted, and callback->Cancel() is called if the lock could not be obtained within wait_ms. Note that the callback may be called directly from this method, or from another thread.
The caller is responsible for making sure that callback does not block.
Implemented in net_instaweb::SchedulerBasedAbstractLock, and net_instaweb::MemLock.
|
pure virtual |
Attempts to take a lock, calling callback->Run() when it is granted. If the current lock holder has locked it for more than steal_ms, the lock is "stolen". If the lock cannot be obtained within wait_ms from when this method was called, the lock is denied, and callback->Cancel() is called.
Note that the callback may be called directly from this method, or from another thread.
The caller is responsible for making sure that callback does not block.
Note that even if wait_ms > steal_ms, callback->Cancel() may be called if there are multiple concurrent attempts to take the lock.
Implemented in net_instaweb::SchedulerBasedAbstractLock, and net_instaweb::MemLock.
|
pure virtual |
Relinquish lock. Non-blocking, however note when this lock is relinquished another lock may be granted, resulting in its callback->Run() method being called from Unlock.
Implemented in net_instaweb::MemLock.