![]() |
Storage Engine API
|
Global lock. More...
#include <d_concurrency.h>
Global lock.
Grabs global resource lock. Allows further (recursive) acquisition of the global lock in any mode, see LockMode. An outermost GlobalLock, when not in a WriteUnitOfWork, calls abandonSnapshot() on destruction. This allows the storage engine to release resources, such as snapshots or locks, that it may have acquired during the transaction.
NOTE: Does not acquire flush lock.
Classes | |
class | EnqueueOnly |
Public Member Functions | |
GlobalLock (OperationContext *opCtx, LockMode lockMode) | |
A GlobalLock without a deadline defaults to Date_t::max() and an InterruptBehavior of kThrow. More... | |
GlobalLock (OperationContext *opCtx, LockMode lockMode, Date_t deadline, InterruptBehavior behavior) | |
A GlobalLock with a deadline requires the interrupt behavior to be explicitly defined. More... | |
GlobalLock (GlobalLock &&) | |
GlobalLock (OperationContext *opCtx, LockMode lockMode, Date_t deadline, InterruptBehavior behavior, EnqueueOnly enqueueOnly) | |
Enqueues lock but does not block on lock acquisition. More... | |
~GlobalLock () | |
void | waitForLockUntil (Date_t deadline) |
Waits for lock to be granted. More... | |
bool | isLocked () const |
Private Member Functions | |
void | _enqueue (LockMode lockMode, Date_t deadline) |
void | _unlock () |
Private Attributes | |
OperationContext *const | _opCtx |
LockResult | _result |
ResourceLock | _pbwm |
InterruptBehavior | _interruptBehavior |
const bool | _isOutermostLock |
|
inline |
A GlobalLock without a deadline defaults to Date_t::max() and an InterruptBehavior of kThrow.
mongo::Lock::GlobalLock::GlobalLock | ( | OperationContext * | opCtx, |
LockMode | lockMode, | ||
Date_t | deadline, | ||
InterruptBehavior | behavior | ||
) |
A GlobalLock with a deadline requires the interrupt behavior to be explicitly defined.
mongo::Lock::GlobalLock::GlobalLock | ( | GlobalLock && | otherLock | ) |
mongo::Lock::GlobalLock::GlobalLock | ( | OperationContext * | opCtx, |
LockMode | lockMode, | ||
Date_t | deadline, | ||
InterruptBehavior | behavior, | ||
EnqueueOnly | enqueueOnly | ||
) |
Enqueues lock but does not block on lock acquisition.
Call waitForLockUntil() to complete locking process.
Does not set that the global lock was taken on the GlobalLockAcquisitionTracker. Call waitForLockUntil to do so.
|
inline |
|
private |
|
inline |
void mongo::Lock::GlobalLock::waitForLockUntil | ( | Date_t | deadline | ) |
Waits for lock to be granted.
Sets that the global lock was taken on the GlobalLockAcquisitionTracker.
|
private |
|
private |
|
private |
|
private |
|
private |