Storage Engine API
mongo::Lock::ResourceLock Class Reference

General purpose RAII wrapper for a resource managed by the lock manager. More...

#include <d_concurrency.h>

Inheritance diagram for mongo::Lock::ResourceLock:
mongo::Lock::ExclusiveLock mongo::Lock::SharedLock

Detailed Description

General purpose RAII wrapper for a resource managed by the lock manager.

See LockMode for the supported modes. Unlike DBLock/Collection lock, this will not do any additional checks/upgrades or global locking. Use ResourceLock for locking resources other than RESOURCE_GLOBAL, RESOURCE_DATABASE and RESOURCE_COLLECTION.

Public Member Functions

 ResourceLock (Locker *locker, ResourceId rid)
 
 ResourceLock (Locker *locker, ResourceId rid, LockMode mode)
 
 ResourceLock (ResourceLock &&otherLock)
 
 ~ResourceLock ()
 
void lock (LockMode mode)
 
void unlock ()
 
bool isLocked () const
 

Private Member Functions

 MONGO_DISALLOW_COPYING (ResourceLock)
 

Private Attributes

const ResourceId _rid
 
Locker *const _locker
 
LockResult _result
 

Constructor & Destructor Documentation

◆ ResourceLock() [1/3]

mongo::Lock::ResourceLock::ResourceLock ( Locker locker,
ResourceId  rid 
)
inline

◆ ResourceLock() [2/3]

mongo::Lock::ResourceLock::ResourceLock ( Locker locker,
ResourceId  rid,
LockMode  mode 
)
inline

◆ ResourceLock() [3/3]

mongo::Lock::ResourceLock::ResourceLock ( ResourceLock &&  otherLock)
inline

◆ ~ResourceLock()

mongo::Lock::ResourceLock::~ResourceLock ( )
inline

Member Function Documentation

◆ isLocked()

bool mongo::Lock::ResourceLock::isLocked ( ) const
inline

◆ lock()

void mongo::Lock::ResourceLock::lock ( LockMode  mode)

◆ MONGO_DISALLOW_COPYING()

mongo::Lock::ResourceLock::MONGO_DISALLOW_COPYING ( ResourceLock  )
private

◆ unlock()

void mongo::Lock::ResourceLock::unlock ( )

Member Data Documentation

◆ _locker

Locker* const mongo::Lock::ResourceLock::_locker
private

◆ _result

LockResult mongo::Lock::ResourceLock::_result
private

◆ _rid

const ResourceId mongo::Lock::ResourceLock::_rid
private

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