summaryrefslogtreecommitdiff
path: root/src/mongo/db/client.h
diff options
context:
space:
mode:
authorEric Milkie <milkie@mongodb.com>2019-11-04 18:49:17 +0000
committerevergreen <evergreen@mongodb.com>2019-11-04 18:49:17 +0000
commited610057b4a87cf96e3ba12bea8ae258a569906e (patch)
tree9239a8d332048a609bbe58e1f9565cd29835e5db /src/mongo/db/client.h
parent927eb1ea8c8b972ec4930d669a9d0804683b10e5 (diff)
downloadmongo-ed610057b4a87cf96e3ba12bea8ae258a569906e.tar.gz
SERVER-44368 protect opCtx's Locker with Client lock
Diffstat (limited to 'src/mongo/db/client.h')
-rw-r--r--src/mongo/db/client.h10
1 files changed, 9 insertions, 1 deletions
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<Locker> swapLockState(std::unique_ptr<Locker> locker);
+
+
private:
friend class ServiceContext;
friend class ThreadClient;