Storage Engine API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mongo::CondVarLockGrantNotification Class Reference

Notfication callback, which stores the last notification result and signals a condition variable, which can be waited on. More...

#include <lock_state.h>

Inheritance diagram for mongo::CondVarLockGrantNotification:
mongo::LockGrantNotification

Detailed Description

Notfication callback, which stores the last notification result and signals a condition variable, which can be waited on.

Public Member Functions

 CondVarLockGrantNotification ()
 
void clear ()
 Clears the object so it can be reused. More...
 
LockResult wait (Milliseconds timeout)
 Uninterruptible blocking method, which waits for the notification to fire. More...
 
LockResult wait (OperationContext *opCtx, Milliseconds timeout)
 Interruptible blocking method, which waits for the notification to fire or an interrupt from the operation context. More...
 
- Public Member Functions inherited from mongo::LockGrantNotification
virtual ~LockGrantNotification ()
 

Private Member Functions

 MONGO_DISALLOW_COPYING (CondVarLockGrantNotification)
 
virtual void notify (ResourceId resId, LockResult result)
 This method is invoked at most once for each lock request and indicates the outcome of the lock acquisition for the specified resource id. More...
 

Private Attributes

stdx::mutex _mutex
 
stdx::condition_variable _cond
 
LockResult _result
 

Constructor & Destructor Documentation

◆ CondVarLockGrantNotification()

mongo::CondVarLockGrantNotification::CondVarLockGrantNotification ( )

Member Function Documentation

◆ clear()

void mongo::CondVarLockGrantNotification::clear ( )

Clears the object so it can be reused.

◆ MONGO_DISALLOW_COPYING()

mongo::CondVarLockGrantNotification::MONGO_DISALLOW_COPYING ( CondVarLockGrantNotification  )
private

◆ notify()

void mongo::CondVarLockGrantNotification::notify ( ResourceId  resId,
LockResult  result 
)
privatevirtual

This method is invoked at most once for each lock request and indicates the outcome of the lock acquisition for the specified resource id.

Cases where it won't be called are if a lock acquisition (be it in waiting or converting state) is cancelled through a call to unlock.

IMPORTANT: This callback runs under a spinlock for the lock manager, so the work done inside must be kept to a minimum and no locks or operations which may block should be run. Also, no methods which call back into the lock manager should be invoked from within this methods (LockManager is not reentrant).

ResourceId for which a lock operation was previously called.

Returns
Outcome of the lock operation.

Implements mongo::LockGrantNotification.

◆ wait() [1/2]

LockResult mongo::CondVarLockGrantNotification::wait ( Milliseconds  timeout)

Uninterruptible blocking method, which waits for the notification to fire.

Parameters
timeoutHow many milliseconds to wait before returning LOCK_TIMEOUT.

◆ wait() [2/2]

LockResult mongo::CondVarLockGrantNotification::wait ( OperationContext *  opCtx,
Milliseconds  timeout 
)

Interruptible blocking method, which waits for the notification to fire or an interrupt from the operation context.

Parameters
opCtxOperationContext to wait on for an interrupt.
timeoutHow many milliseconds to wait before returning LOCK_TIMEOUT.

Member Data Documentation

◆ _cond

stdx::condition_variable mongo::CondVarLockGrantNotification::_cond
private

◆ _mutex

stdx::mutex mongo::CondVarLockGrantNotification::_mutex
private

◆ _result

LockResult mongo::CondVarLockGrantNotification::_result
private

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