Page Speed Optimization Libraries
1.13.35.1
|
Public Member Functions | |
virtual void | LockTimedWait (int64 wait_ms, Function *callback) |
virtual void | LockTimedWaitStealOld (int64 wait_ms, int64 steal_ms, Function *callback) |
virtual void | Unlock () |
virtual GoogleString | name () const |
The name the lock was created with, for debugging/logging purposes. | |
virtual bool | Held () |
void | Wakeup () |
int64 | wakeup_time_ms () const |
int | StableCompare (const MemLock *that) const |
Public Member Functions inherited from net_instaweb::NamedLock | |
virtual | ~NamedLock () |
Destructors of extending classes must unlock the lock if held on destruct. | |
Static Public Attributes | |
static const int64 | kDoNotSteal = -1 |
static const int64 | kNotHeld = -1 |
static const int64 | kNotPending = -1 |
Friends | |
class | MemLockState |
|
inlinevirtual |
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.
Implements net_instaweb::NamedLock.
|
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.
Implements net_instaweb::NamedLock.
|
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.
Implements net_instaweb::NamedLock.
int net_instaweb::MemLock::StableCompare | ( | const MemLock * | that | ) | const |
Computes a stable ordering for multiple locks with the same time-based criteria based primarily on the name, and secondarily on the sequence number.
Returns -1 if this is less than that. Returns 1 if this is greater than that. Check-fails if they compare as the same.
|
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.
Implements net_instaweb::NamedLock.
void net_instaweb::MemLock::Wakeup | ( | ) |
Entry-point for the lock-manager to wake up this lock, stealing it or canceling as needed.
|
inline |
Returns the currently scheduled time of the next required wakeup for this lock, based on the earlier cancel timeout and time it gets to steal the lock that is currently held. Note that this value can be changed by CalculateWakeupTime, This value is in absolute time since 1970.