summaryrefslogtreecommitdiffstats
path: root/persistence
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-08-11 13:16:40 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-08-11 13:16:40 +0200
commitc521ef714c7054c5a5c0d2e6b72f0cd6d34ec2e5 (patch)
tree376770123dd08bff927dc7158f41ad30dfd64ef5 /persistence
parent41709673f0165f16496ecf37162ed7dac06b5295 (diff)
compare_exchange_strong had different order of expected versus new value.
Diffstat (limited to 'persistence')
-rw-r--r--persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
index 0aec6877367..8977b505740 100644
--- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
+++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
@@ -930,8 +930,8 @@ DummyPersistence::acquireBucketWithLock(const Bucket& b) const
// Atomic CAS might be a bit overkill, but since we "release" the bucket
// outside of the mutex, we want to ensure the write is visible across all
// threads.
- bool my_true(true);
- bool bucketNotInUse(it->second->_inUse.compare_exchange_strong(my_true, false));
+ bool my_false(false);
+ bool bucketNotInUse(it->second->_inUse.compare_exchange_strong(my_false, true));
if (!bucketNotInUse) {
LOG(error, "Attempted to acquire %s, but it was already marked as being in use!",
b.toString().c_str());
@@ -944,8 +944,8 @@ DummyPersistence::acquireBucketWithLock(const Bucket& b) const
void
DummyPersistence::releaseBucketNoLock(const BucketContent& bc) const
{
- bool my_false(false);
- bool bucketInUse(bc._inUse.compare_exchange_strong(my_false, true));
+ bool my_true(true);
+ bool bucketInUse(bc._inUse.compare_exchange_strong(my_true, false));
assert(bucketInUse);
(void) bucketInUse;
}