summaryrefslogtreecommitdiff
path: root/src/mongo/db/operation_context_noop.h
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2015-08-06 13:26:55 -0400
committerSpencer T Brody <spencer@mongodb.com>2015-08-12 11:27:43 -0400
commitbe7db282c80c981882ea67f909eb6be4e53d2d4b (patch)
tree615bcfdcc2e25e5db24b4d82f3db7cff1f9c4f91 /src/mongo/db/operation_context_noop.h
parent86a3e6352eb27fd2e6115299bcec5103a830fe36 (diff)
downloadmongo-be7db282c80c981882ea67f909eb6be4e53d2d4b.tar.gz
SERVER-19543 Thread OperationContext through to everywhere that accesses the CatalogManager
Diffstat (limited to 'src/mongo/db/operation_context_noop.h')
-rw-r--r--src/mongo/db/operation_context_noop.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mongo/db/operation_context_noop.h b/src/mongo/db/operation_context_noop.h
index 172ba5f5d5d..3d380605d58 100644
--- a/src/mongo/db/operation_context_noop.h
+++ b/src/mongo/db/operation_context_noop.h
@@ -54,9 +54,20 @@ public:
OperationContextNoop(Client* client, unsigned int opId, Locker* locker, RecoveryUnit* ru)
: OperationContext(client, opId, locker), _recoveryUnit(ru) {
_locker.reset(lockState());
+
+ if (client) {
+ stdx::lock_guard<Client> lk(*client);
+ client->setOperationContext(this);
+ }
}
- virtual ~OperationContextNoop() = default;
+ virtual ~OperationContextNoop() {
+ auto client = getClient();
+ if (client) {
+ stdx::lock_guard<Client> lk(*client);
+ client->resetOperationContext();
+ }
+ }
virtual RecoveryUnit* recoveryUnit() const override {
return _recoveryUnit.get();