summaryrefslogtreecommitdiff
path: root/src/mongo/db/curop.h
diff options
context:
space:
mode:
authorJustin Seyster <justin.seyster@mongodb.com>2020-08-10 18:46:29 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-12 02:13:42 +0000
commitfa9e65944ee087a2e86341892311c6c630a8a9e3 (patch)
tree896bd4e66315c5b7dc566adf61ebf07a458158c5 /src/mongo/db/curop.h
parent8ddfcea4915e55fe85349b7ed792abd0d41d075d (diff)
downloadmongo-fa9e65944ee087a2e86341892311c6c630a8a9e3.tar.gz
SERVER-50240 Make CurOp::_numYields atomic
Diffstat (limited to 'src/mongo/db/curop.h')
-rw-r--r--src/mongo/db/curop.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h
index 1309d9835a2..8702daae43c 100644
--- a/src/mongo/db/curop.h
+++ b/src/mongo/db/curop.h
@@ -683,15 +683,15 @@ public:
}
void yielded(int numYields = 1) {
- _numYields += numYields;
- } // Should be _inlock()?
+ _numYields.fetchAndAdd(numYields);
+ }
/**
* Returns the number of times yielded() was called. Callers on threads other
* than the one executing the operation must lock the client.
*/
int numYields() const {
- return _numYields;
+ return _numYields.load();
}
/**
@@ -771,7 +771,7 @@ private:
std::string _failPointMessage; // Used to store FailPoint information.
std::string _message;
ProgressMeter _progressMeter;
- int _numYields{0};
+ AtomicWord<int> _numYields{0};
// A GenericCursor containing information about the active cursor for a getMore operation.
boost::optional<GenericCursor> _genericCursor;