summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
diff options
context:
space:
mode:
authorShelley Jain <shelleyjain@Shelleys-MacBook-Pro.local>2019-05-30 17:00:30 -0400
committerShaileja Jain <shaileja.jain@gmail.com>2019-06-07 14:13:22 -0400
commitc56c3d58260b734eb0a40dabf87ee4be4823b7ed (patch)
tree77e1b966e377557fa933e02c467da914f2d06c00 /src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
parent7272900e4c2e8aeeb442f7fd82a24573a5e32581 (diff)
downloadmongo-c56c3d58260b734eb0a40dabf87ee4be4823b7ed.tar.gz
SERVER-40004 Modified compareAndSwap to return boolean
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
index fb33870e114..fb41f7c2b3b 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
@@ -215,16 +215,9 @@ WiredTigerSessionCache::~WiredTigerSessionCache() {
}
void WiredTigerSessionCache::shuttingDown() {
- uint32_t actual = _shuttingDown.load();
- uint32_t expected;
-
// Try to atomically set _shuttingDown flag, but just return if another thread was first.
- do {
- expected = actual;
- actual = _shuttingDown.compareAndSwap(expected, expected | kShuttingDownMask);
- if (actual & kShuttingDownMask)
- return;
- } while (actual != expected);
+ if (_shuttingDown.fetchAndBitOr(kShuttingDownMask) & kShuttingDownMask)
+ return;
// Spin as long as there are threads in releaseSession
while (_shuttingDown.load() != kShuttingDownMask) {