diff options
Diffstat (limited to 'src/mongo/db/concurrency/lock_state.h')
-rw-r--r-- | src/mongo/db/concurrency/lock_state.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mongo/db/concurrency/lock_state.h b/src/mongo/db/concurrency/lock_state.h index de19f38ae44..45433391cea 100644 --- a/src/mongo/db/concurrency/lock_state.h +++ b/src/mongo/db/concurrency/lock_state.h @@ -32,6 +32,7 @@ #include "mongo/db/concurrency/fast_map_noalloc.h" #include "mongo/db/concurrency/locker.h" +#include "mongo/platform/atomic_word.h" #include "mongo/util/concurrency/spin_lock.h" namespace mongo { @@ -92,6 +93,8 @@ public: virtual ~LockerImpl(); + virtual ClientState getClientState() const; + virtual LockerId getId() const { return _id; } @@ -178,9 +181,9 @@ private: /** * The main functionality of the unlock method, except accepts iterator in order to avoid - * additional lookups during unlockAll. + * additional lookups during unlockAll. Frees locks immediately, so must not call inside WUOW. */ - bool _unlockImpl(LockRequestsMap::Iterator& it); + bool _unlockImpl(LockRequestsMap::Iterator* it); /** * MMAP V1 locking code yields and re-acquires the flush lock occasionally in order to @@ -189,7 +192,6 @@ private: */ LockMode _getModeForMMAPV1FlushLock() const; - // Used to disambiguate different lockers const LockerId _id; @@ -217,6 +219,9 @@ private: // Mode for which the Locker acquired a ticket, or MODE_NONE if no ticket was acquired. LockMode _modeForTicket = MODE_NONE; + // Indicates whether the client is active reader/writer or is queued. + AtomicWord<ClientState> _clientState{kInactive}; + ////////////////////////////////////////////////////////////////////////////////////////// // // Methods merged from LockState, which should eventually be removed or changed to methods |