diff options
author | Shelley Jain <shelleyjain@Shelleys-MacBook-Pro.local> | 2019-05-30 17:00:30 -0400 |
---|---|---|
committer | Shaileja Jain <shaileja.jain@gmail.com> | 2019-06-07 14:13:22 -0400 |
commit | c56c3d58260b734eb0a40dabf87ee4be4823b7ed (patch) | |
tree | 77e1b966e377557fa933e02c467da914f2d06c00 /src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp | |
parent | 7272900e4c2e8aeeb442f7fd82a24573a5e32581 (diff) | |
download | mongo-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.cpp | 11 |
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) { |