From ed610057b4a87cf96e3ba12bea8ae258a569906e Mon Sep 17 00:00:00 2001 From: Eric Milkie Date: Mon, 4 Nov 2019 18:49:17 +0000 Subject: SERVER-44368 protect opCtx's Locker with Client lock --- src/mongo/db/client.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/mongo/db/client.h') diff --git a/src/mongo/db/client.h b/src/mongo/db/client.h index 75e828c63c3..6aea69b5c2a 100644 --- a/src/mongo/db/client.h +++ b/src/mongo/db/client.h @@ -52,6 +52,7 @@ namespace mongo { class Collection; +class Locker; class OperationContext; class ThreadClient; @@ -144,7 +145,7 @@ public: void reportState(BSONObjBuilder& builder); // Ensures stability of the client's OperationContext. When the client is locked, - // the OperationContext will not disappear. + // the OperationContext and the Locker within it will not disappear. void lock() { _lock.lock(); } @@ -229,6 +230,13 @@ public: return _prng; } + /** + * Safely swaps the locker in the OperationContext, releasing the old locker to the caller. + * Locks this Client to do this safely. + */ + std::unique_ptr swapLockState(std::unique_ptr locker); + + private: friend class ServiceContext; friend class ThreadClient; -- cgit v1.2.1