Storage Engine API
mongo::Locker Class Referenceabstract

Interface for acquiring locks. More...

#include <locker.h>

Inheritance diagram for mongo::Locker:
mongo::LockerImpl< false > mongo::LockerImpl< IsForMMAPV1 > mongo::LockerNoop mongo::LockerForTests

Detailed Description

Interface for acquiring locks.

One of those objects will have to be instantiated for each request (transaction).

Lock/unlock methods must always be called from a single thread.

Classes

struct  LockerInfo
 Returns information and locking statistics for this instance of the locker. More...
 
struct  LockSnapshot
 LockSnapshot captures the state of all resources that are locked, what modes they're locked in, and how many times they've been locked in that mode. More...
 
struct  OneLock
 Describes a single lock acquisition for reporting/serialization purposes. More...
 

Public Types

enum  ClientState {
  kInactive, kActiveReader, kActiveWriter, kQueuedReader,
  kQueuedWriter
}
 State for reporting the number of active and queued reader and writer clients. More...
 

Public Member Functions

virtual ~Locker ()
 
virtual bool isNoop () const
 Returns true if this is an instance of LockerNoop. More...
 
virtual ClientState getClientState () const =0
 Return whether client is holding any locks (active), or is queued on any locks or waiting for a ticket (throttled). More...
 
virtual LockerId getId () const =0
 
virtual stdx::thread::id getThreadId () const =0
 Get a platform-specific thread identifier of the thread which owns the this locker for tracing purposes. More...
 
virtual void updateThreadIdToCurrentThread ()=0
 Updates any cached thread id values to represent the current thread. More...
 
virtual void unsetThreadId ()=0
 Clears any cached thread id values. More...
 
virtual void setSharedLocksShouldTwoPhaseLock (bool sharedLocksShouldTwoPhaseLock)=0
 Indicate that shared locks should participate in two-phase locking for this Locker instance. More...
 
virtual void setMaxLockTimeout (Milliseconds maxTimeout)=0
 This is useful to ensure that potential deadlocks do not occur. More...
 
virtual bool hasMaxLockTimeout ()=0
 Returns whether this Locker has a maximum lock timeout set. More...
 
virtual void unsetMaxLockTimeout ()=0
 Clears the max lock timeout override set by setMaxLockTimeout() above. More...
 
virtual LockResult lockGlobal (OperationContext *opCtx, LockMode mode)=0
 This should be the first method invoked for a particular Locker object. More...
 
virtual LockResult lockGlobal (LockMode mode)=0
 
virtual LockResult lockGlobalBegin (OperationContext *opCtx, LockMode mode, Date_t deadline)=0
 Requests the global lock to be acquired in the specified mode. More...
 
virtual LockResult lockGlobalBegin (LockMode mode, Date_t deadline)=0
 
virtual LockResult lockGlobalComplete (OperationContext *opCtx, Date_t deadline)=0
 Calling lockGlobalComplete without an OperationContext does not allow the lock acquisition to be interrupted. More...
 
virtual LockResult lockGlobalComplete (Date_t deadline)=0
 
virtual void lockMMAPV1Flush ()=0
 This method is used only in the MMAP V1 storage engine, otherwise it is a no-op. More...
 
virtual bool unlockGlobal ()=0
 Decrements the reference count on the global lock. More...
 
virtual void downgradeGlobalXtoSForMMAPV1 ()=0
 This is only necessary for the MMAP V1 engine and in particular, the fsyncLock command which needs to first acquire the global lock in X-mode for truncating the journal and then downgrade to S before it blocks. More...
 
virtual void beginWriteUnitOfWork ()=0
 beginWriteUnitOfWork/endWriteUnitOfWork are called at the start and end of WriteUnitOfWorks. More...
 
virtual void endWriteUnitOfWork ()=0
 
virtual bool inAWriteUnitOfWork () const =0
 
virtual LockResult lock (OperationContext *opCtx, ResourceId resId, LockMode mode, Date_t deadline=Date_t::max(), bool checkDeadlock=false)=0
 Acquires lock on the specified resource in the specified mode and returns the outcome of the operation. More...
 
virtual LockResult lock (ResourceId resId, LockMode mode, Date_t deadline=Date_t::max(), bool checkDeadlock=false)=0
 Calling lock without an OperationContext does not allow LOCK_WAITING states to be interrupted. More...
 
virtual void downgrade (ResourceId resId, LockMode newMode)=0
 Downgrades the specified resource's lock mode without changing the reference count. More...
 
virtual bool unlock (ResourceId resId)=0
 Releases a lock previously acquired through a lock call. More...
 
virtual LockMode getLockMode (ResourceId resId) const =0
 Retrieves the mode in which a lock is held or checks whether the lock held for a particular resource covers the specified mode. More...
 
virtual bool isLockHeldForMode (ResourceId resId, LockMode mode) const =0
 
virtual bool isDbLockedForMode (StringData dbName, LockMode mode) const =0
 
virtual bool isCollectionLockedForMode (StringData ns, LockMode mode) const =0
 
virtual ResourceId getWaitingResource () const =0
 Returns the resource that this locker is waiting/blocked on (if any). More...
 
virtual void getLockerInfo (LockerInfo *lockerInfo) const =0
 
virtual boost::optional< LockerInfogetLockerInfo () const =0
 Returns boost::none if this is an instance of LockerNoop, or a populated LockerInfo otherwise. More...
 
virtual bool saveLockStateAndUnlock (LockSnapshot *stateOut)=0
 Retrieves all locks held by this transaction, other than RESOURCE_MUTEX locks, and what mode they're held in. More...
 
virtual void restoreLockState (OperationContext *opCtx, const LockSnapshot &stateToRestore)=0
 Re-locks all locks whose state was stored in 'stateToRestore'. More...
 
virtual void restoreLockState (const LockSnapshot &stateToRestore)=0
 
virtual void releaseTicket ()=0
 Releases the ticket associated with the Locker. More...
 
virtual void reacquireTicket (OperationContext *opCtx)=0
 Reacquires a ticket for the Locker. More...
 
virtual void dump () const =0
 
virtual bool isW () const =0
 
virtual bool isR () const =0
 
virtual bool isLocked () const =0
 
virtual bool isWriteLocked () const =0
 
virtual bool isReadLocked () const =0
 
virtual bool isGlobalLockedRecursively ()=0
 
virtual bool hasLockPending () const =0
 Pending means we are currently trying to get a lock (could be the parallel batch writer lock). More...
 
void setShouldConflictWithSecondaryBatchApplication (bool newValue)
 If set to false, this opts out of conflicting with replication's use of the ParallelBatchWriterMode lock. More...
 
bool shouldConflictWithSecondaryBatchApplication () const
 
void setShouldAcquireTicket (bool newValue)
 If set to false, this opts out of the ticket mechanism. More...
 
bool shouldAcquireTicket () const
 
unsigned numResourcesToUnlockAtEndUnitOfWorkForTest () const
 This function is for unit testing only. More...
 

Static Public Member Functions

static void setGlobalThrottling (class TicketHolder *reading, class TicketHolder *writing)
 Require global lock attempts to obtain tickets from 'reading' (for MODE_S and MODE_IS), and from 'writing' (for MODE_IX), which must have static lifetimes. More...
 

Protected Member Functions

 Locker ()
 

Protected Attributes

int _uninterruptibleLocksRequested = 0
 The number of callers that are guarding from lock interruptions. More...
 
unsigned _numResourcesToUnlockAtEndUnitOfWork = 0
 The number of LockRequests to unlock at the end of this WUOW. More...
 

Private Member Functions

 MONGO_DISALLOW_COPYING (Locker)
 

Private Attributes

bool _shouldConflictWithSecondaryBatchApplication = true
 
bool _shouldAcquireTicket = true
 

Friends

class UninterruptibleLockGuard
 

Member Enumeration Documentation

◆ ClientState

State for reporting the number of active and queued reader and writer clients.

Enumerator
kInactive 
kActiveReader 
kActiveWriter 
kQueuedReader 
kQueuedWriter 

Constructor & Destructor Documentation

◆ ~Locker()

virtual mongo::Locker::~Locker ( )
inlinevirtual

◆ Locker()

mongo::Locker::Locker ( )
inlineprotected

Member Function Documentation

◆ beginWriteUnitOfWork()

virtual void mongo::Locker::beginWriteUnitOfWork ( )
pure virtual

beginWriteUnitOfWork/endWriteUnitOfWork are called at the start and end of WriteUnitOfWorks.

They can be used to implement two-phase locking. Each call to begin should be matched with an eventual call to end.

endWriteUnitOfWork, if not called in a nested WUOW, will release all two-phase locking held lock resources.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ downgrade()

virtual void mongo::Locker::downgrade ( ResourceId  resId,
LockMode  newMode 
)
pure virtual

Downgrades the specified resource's lock mode without changing the reference count.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ downgradeGlobalXtoSForMMAPV1()

virtual void mongo::Locker::downgradeGlobalXtoSForMMAPV1 ( )
pure virtual

This is only necessary for the MMAP V1 engine and in particular, the fsyncLock command which needs to first acquire the global lock in X-mode for truncating the journal and then downgrade to S before it blocks.

The downgrade is necessary in order to be nice and not block readers while under fsyncLock.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ dump()

virtual void mongo::Locker::dump ( ) const
pure virtual

◆ endWriteUnitOfWork()

virtual void mongo::Locker::endWriteUnitOfWork ( )
pure virtual

◆ getClientState()

virtual ClientState mongo::Locker::getClientState ( ) const
pure virtual

Return whether client is holding any locks (active), or is queued on any locks or waiting for a ticket (throttled).

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ getId()

virtual LockerId mongo::Locker::getId ( ) const
pure virtual

◆ getLockerInfo() [1/2]

virtual void mongo::Locker::getLockerInfo ( LockerInfo lockerInfo) const
pure virtual

◆ getLockerInfo() [2/2]

virtual boost::optional<LockerInfo> mongo::Locker::getLockerInfo ( ) const
pure virtual

Returns boost::none if this is an instance of LockerNoop, or a populated LockerInfo otherwise.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ getLockMode()

virtual LockMode mongo::Locker::getLockMode ( ResourceId  resId) const
pure virtual

Retrieves the mode in which a lock is held or checks whether the lock held for a particular resource covers the specified mode.

For example isLockHeldForMode will return true for MODE_S, if MODE_X is already held, because MODE_X covers MODE_S.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ getThreadId()

virtual stdx::thread::id mongo::Locker::getThreadId ( ) const
pure virtual

Get a platform-specific thread identifier of the thread which owns the this locker for tracing purposes.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ getWaitingResource()

virtual ResourceId mongo::Locker::getWaitingResource ( ) const
pure virtual

Returns the resource that this locker is waiting/blocked on (if any).

If the locker is not waiting for a resource the returned value will be invalid (isValid() == false).

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ hasLockPending()

virtual bool mongo::Locker::hasLockPending ( ) const
pure virtual

Pending means we are currently trying to get a lock (could be the parallel batch writer lock).

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ hasMaxLockTimeout()

virtual bool mongo::Locker::hasMaxLockTimeout ( )
pure virtual

Returns whether this Locker has a maximum lock timeout set.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ inAWriteUnitOfWork()

virtual bool mongo::Locker::inAWriteUnitOfWork ( ) const
pure virtual

◆ isCollectionLockedForMode()

virtual bool mongo::Locker::isCollectionLockedForMode ( StringData  ns,
LockMode  mode 
) const
pure virtual

◆ isDbLockedForMode()

virtual bool mongo::Locker::isDbLockedForMode ( StringData  dbName,
LockMode  mode 
) const
pure virtual

◆ isGlobalLockedRecursively()

virtual bool mongo::Locker::isGlobalLockedRecursively ( )
pure virtual

◆ isLocked()

virtual bool mongo::Locker::isLocked ( ) const
pure virtual

◆ isLockHeldForMode()

virtual bool mongo::Locker::isLockHeldForMode ( ResourceId  resId,
LockMode  mode 
) const
pure virtual

◆ isNoop()

virtual bool mongo::Locker::isNoop ( ) const
inlinevirtual

Returns true if this is an instance of LockerNoop.

Because LockerNoop doesn't implement many methods, some users may need to check this first to find out what is safe to call. LockerNoop is only used in unittests and for a brief period at startup, so you can assume you hold the equivalent of a MODE_X lock when using it.

TODO get rid of this once we kill LockerNoop.

Reimplemented in mongo::LockerNoop.

◆ isR()

virtual bool mongo::Locker::isR ( ) const
pure virtual

◆ isReadLocked()

virtual bool mongo::Locker::isReadLocked ( ) const
pure virtual

◆ isW()

virtual bool mongo::Locker::isW ( ) const
pure virtual

◆ isWriteLocked()

virtual bool mongo::Locker::isWriteLocked ( ) const
pure virtual

◆ lock() [1/2]

virtual LockResult mongo::Locker::lock ( OperationContext *  opCtx,
ResourceId  resId,
LockMode  mode,
Date_t  deadline = Date_t::max(),
bool  checkDeadlock = false 
)
pure virtual

Acquires lock on the specified resource in the specified mode and returns the outcome of the operation.

See the details for LockResult for more information on what the different results mean.

Each successful acquisition of a lock on a given resource increments the reference count of the lock. Therefore, each call, which returns LOCK_OK must be matched with a corresponding call to unlock.

If setLockTimeoutMillis has been called, then a lock request with a Date_t::max() deadline may throw a LockTimeout error. See setMaxLockTimeout() above for details.

Parameters
opCtxIf provided, will be used to interrupt a LOCK_WAITING state.
resIdId of the resource to be locked.
modeMode in which the resource should be locked. Lock upgrades are allowed.
deadlineHow long to wait for the lock to be granted, before returning LOCK_TIMEOUT. This parameter defaults to an infinite deadline. If Milliseconds(0) is passed, the request will return immediately, if the request could not be granted right away.
checkDeadlockWhether to enable deadlock detection for this acquisition. This parameter is put in place until we can handle deadlocks at all places, which acquire locks.
Returns
All LockResults except for LOCK_WAITING, because it blocks.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ lock() [2/2]

virtual LockResult mongo::Locker::lock ( ResourceId  resId,
LockMode  mode,
Date_t  deadline = Date_t::max(),
bool  checkDeadlock = false 
)
pure virtual

Calling lock without an OperationContext does not allow LOCK_WAITING states to be interrupted.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ lockGlobal() [1/2]

virtual LockResult mongo::Locker::lockGlobal ( OperationContext *  opCtx,
LockMode  mode 
)
pure virtual

This should be the first method invoked for a particular Locker object.

It acquires the Global lock in the specified mode and effectively indicates the mode of the operation. This is what the lock modes on the global lock mean:

IX - Regular write operation IS - Regular read operation S - Stops all write activity. Used for administrative operations (repl, etc). X - Stops all activity. Used for administrative operations (repl state changes, shutdown, etc).

This method can be called recursively, but each call to lockGlobal must be accompanied by a call to unlockGlobal.

Parameters
opCtxOperationContext used to interrupt the lock waiting, if provided.
modeMode in which the global lock should be acquired. Also indicates the intent of the operation.
Returns
LOCK_OK, if the global lock (and the flush lock, for the MMAP V1 engine) were acquired within the specified time bound. Otherwise, the respective failure code and neither lock will be acquired.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ lockGlobal() [2/2]

virtual LockResult mongo::Locker::lockGlobal ( LockMode  mode)
pure virtual

◆ lockGlobalBegin() [1/2]

virtual LockResult mongo::Locker::lockGlobalBegin ( OperationContext *  opCtx,
LockMode  mode,
Date_t  deadline 
)
pure virtual

Requests the global lock to be acquired in the specified mode.

See the comments for lockBegin/Complete for more information on the semantics. The deadline indicates the absolute time point when this lock acquisition will time out, if not yet granted. The lockGlobalBegin method has a deadline for use with the TicketHolder, if there is one.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ lockGlobalBegin() [2/2]

virtual LockResult mongo::Locker::lockGlobalBegin ( LockMode  mode,
Date_t  deadline 
)
pure virtual

◆ lockGlobalComplete() [1/2]

virtual LockResult mongo::Locker::lockGlobalComplete ( OperationContext *  opCtx,
Date_t  deadline 
)
pure virtual

Calling lockGlobalComplete without an OperationContext does not allow the lock acquisition to be interrupted.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ lockGlobalComplete() [2/2]

virtual LockResult mongo::Locker::lockGlobalComplete ( Date_t  deadline)
pure virtual

◆ lockMMAPV1Flush()

virtual void mongo::Locker::lockMMAPV1Flush ( )
pure virtual

This method is used only in the MMAP V1 storage engine, otherwise it is a no-op.

See the comments in the implementation for more details on how MMAP V1 journaling works.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ MONGO_DISALLOW_COPYING()

mongo::Locker::MONGO_DISALLOW_COPYING ( Locker  )
private

◆ numResourcesToUnlockAtEndUnitOfWorkForTest()

unsigned mongo::Locker::numResourcesToUnlockAtEndUnitOfWorkForTest ( ) const
inline

This function is for unit testing only.

◆ reacquireTicket()

virtual void mongo::Locker::reacquireTicket ( OperationContext *  opCtx)
pure virtual

Reacquires a ticket for the Locker.

This must only be called after releaseTicket(). It restores the ticket under its previous LockMode. An OperationContext is required to interrupt the ticket acquisition to prevent deadlocks. A dead lock is possible when a ticket is reacquired while holding a lock.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ releaseTicket()

virtual void mongo::Locker::releaseTicket ( )
pure virtual

Releases the ticket associated with the Locker.

This allows locks to be held without contributing to reader/writer throttling.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ restoreLockState() [1/2]

virtual void mongo::Locker::restoreLockState ( OperationContext *  opCtx,
const LockSnapshot stateToRestore 
)
pure virtual

Re-locks all locks whose state was stored in 'stateToRestore'.

Parameters
opCtxAn operation context that enables the restoration to be interrupted.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ restoreLockState() [2/2]

virtual void mongo::Locker::restoreLockState ( const LockSnapshot stateToRestore)
pure virtual

◆ saveLockStateAndUnlock()

virtual bool mongo::Locker::saveLockStateAndUnlock ( LockSnapshot stateOut)
pure virtual

Retrieves all locks held by this transaction, other than RESOURCE_MUTEX locks, and what mode they're held in.

Stores these locks in 'stateOut', destroying any previous state. Unlocks all locks held by this transaction. This functionality is used for yielding, which is voluntary/cooperative lock release and reacquisition in order to allow for interleaving of otherwise conflicting long-running operations.

This functionality is also used for releasing locks on databases and collections when cursors are dormant and waiting for a getMore request.

Returns true if locks are released. It is expected that restoreLockerImpl will be called in the future.

Returns false if locks are not released. restoreLockState(...) does not need to be called in this case.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ setGlobalThrottling()

void mongo::Locker::setGlobalThrottling ( class TicketHolder *  reading,
class TicketHolder *  writing 
)
static

Require global lock attempts to obtain tickets from 'reading' (for MODE_S and MODE_IS), and from 'writing' (for MODE_IX), which must have static lifetimes.

There is no throttling for MODE_X, as there can only ever be a single locker using this mode. The throttling is intended to defend against arge drops in throughput under high load due to too much concurrency.

◆ setMaxLockTimeout()

virtual void mongo::Locker::setMaxLockTimeout ( Milliseconds  maxTimeout)
pure virtual

This is useful to ensure that potential deadlocks do not occur.

Overrides provided timeouts in lock requests with 'maxTimeout' if the provided timeout is greater. Basically, no lock acquisition will take longer than 'maxTimeout'.

If an UninterruptibleLockGuard is set during a lock request, the max timeout override will be ignored.

Future lock requests may throw LockTimeout errors if a lock request provides a Date_t::max() deadline and 'maxTimeout' is reached. Presumably these callers do not expect to handle lock acquisition failure, so this is done to ensure the caller does not proceed as if the lock were successfully acquired.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ setSharedLocksShouldTwoPhaseLock()

virtual void mongo::Locker::setSharedLocksShouldTwoPhaseLock ( bool  sharedLocksShouldTwoPhaseLock)
pure virtual

Indicate that shared locks should participate in two-phase locking for this Locker instance.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ setShouldAcquireTicket()

void mongo::Locker::setShouldAcquireTicket ( bool  newValue)
inline

If set to false, this opts out of the ticket mechanism.

This should be used sparingly for special purpose threads, such as FTDC.

◆ setShouldConflictWithSecondaryBatchApplication()

void mongo::Locker::setShouldConflictWithSecondaryBatchApplication ( bool  newValue)
inline

If set to false, this opts out of conflicting with replication's use of the ParallelBatchWriterMode lock.

Code that opts-out must be ok with seeing an inconsistent view of data because within a batch, secondaries apply operations in a different order than on the primary. User operations should never opt out.

◆ shouldAcquireTicket()

bool mongo::Locker::shouldAcquireTicket ( ) const
inline

◆ shouldConflictWithSecondaryBatchApplication()

bool mongo::Locker::shouldConflictWithSecondaryBatchApplication ( ) const
inline

◆ unlock()

virtual bool mongo::Locker::unlock ( ResourceId  resId)
pure virtual

Releases a lock previously acquired through a lock call.

It is an error to try to release lock which has not been previously acquired (invariant violation).

Returns
true if the lock was actually released; false if only the reference count was decremented, but the lock is still held.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ unlockGlobal()

virtual bool mongo::Locker::unlockGlobal ( )
pure virtual

Decrements the reference count on the global lock.

If the reference count on the global lock hits zero, the transaction is over, and unlockGlobal unlocks all other locks except for RESOURCE_MUTEX locks.

Returns
true if this is the last endTransaction call (i.e., the global lock was released); false if there are still references on the global lock. This value should not be relied on and is only used for assertion purposes.
false if the global lock is still held.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ unsetMaxLockTimeout()

virtual void mongo::Locker::unsetMaxLockTimeout ( )
pure virtual

Clears the max lock timeout override set by setMaxLockTimeout() above.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ unsetThreadId()

virtual void mongo::Locker::unsetThreadId ( )
pure virtual

Clears any cached thread id values.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

◆ updateThreadIdToCurrentThread()

virtual void mongo::Locker::updateThreadIdToCurrentThread ( )
pure virtual

Updates any cached thread id values to represent the current thread.

Implemented in mongo::LockerImpl< IsForMMAPV1 >, mongo::LockerImpl< false >, and mongo::LockerNoop.

Friends And Related Function Documentation

◆ UninterruptibleLockGuard

friend class UninterruptibleLockGuard
friend

Member Data Documentation

◆ _numResourcesToUnlockAtEndUnitOfWork

unsigned mongo::Locker::_numResourcesToUnlockAtEndUnitOfWork = 0
protected

The number of LockRequests to unlock at the end of this WUOW.

This is used for locks participating in two-phase locking.

◆ _shouldAcquireTicket

bool mongo::Locker::_shouldAcquireTicket = true
private

◆ _shouldConflictWithSecondaryBatchApplication

bool mongo::Locker::_shouldConflictWithSecondaryBatchApplication = true
private

◆ _uninterruptibleLocksRequested

int mongo::Locker::_uninterruptibleLocksRequested = 0
protected

The number of callers that are guarding from lock interruptions.

When 0, all lock acquisitions are interruptible. When positive, no lock acquisitions are interruptible. This is only true for database and global locks. Collection locks are never interruptible.


The documentation for this class was generated from the following files: