diff options
author | Eric Milkie <milkie@mongodb.com> | 2019-11-04 18:49:17 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-11-04 18:49:17 +0000 |
commit | ed610057b4a87cf96e3ba12bea8ae258a569906e (patch) | |
tree | 9239a8d332048a609bbe58e1f9565cd29835e5db /src/mongo/db/client.cpp | |
parent | 927eb1ea8c8b972ec4930d669a9d0804683b10e5 (diff) | |
download | mongo-ed610057b4a87cf96e3ba12bea8ae258a569906e.tar.gz |
SERVER-44368 protect opCtx's Locker with Client lock
Diffstat (limited to 'src/mongo/db/client.cpp')
-rw-r--r-- | src/mongo/db/client.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp index 3bac054c2b1..a24e7a06453 100644 --- a/src/mongo/db/client.cpp +++ b/src/mongo/db/client.cpp @@ -41,6 +41,7 @@ #include "mongo/base/status.h" #include "mongo/db/lasterror.h" +#include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/thread_name.h" @@ -145,6 +146,12 @@ Client* Client::getCurrent() { return currentClient.get(); } +std::unique_ptr<Locker> Client::swapLockState(std::unique_ptr<Locker> locker) { + scoped_spinlock scopedLock(_lock); + invariant(_opCtx); + return _opCtx->swapLockState(std::move(locker), scopedLock); +} + Client& cc() { invariant(haveClient()); return *Client::getCurrent(); |