summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-04-20 17:02:50 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2016-04-20 17:14:06 +1000
commiteaa7b5f0fcc62f356c33a2c56f45b609a73ca5dd (patch)
tree60569abe0ce518618d90c20eb2076aa83c201e31 /src/include
parent7bcf6fc668657e734c370db349283243492fa010 (diff)
Merge pull request #2670 from wiredtiger/wt-2566mongodb-3.3.5
WT-2566 Lock/unlock operations should imply memory barriers. (cherry picked from commit 05cfbc26c2ab2099d7c98080a79ae67ea531c24f)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/mutex.i12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/include/mutex.i b/src/include/mutex.i
index 52250f84ab3..65956c13c08 100644
--- a/src/include/mutex.i
+++ b/src/include/mutex.i
@@ -306,6 +306,12 @@ __wt_fair_lock(WT_SESSION_IMPL *session, WT_FAIR_LOCK *lock)
__wt_sleep(0, 10);
}
+ /*
+ * Applications depend on a barrier here so that operations holding the
+ * lock see consistent data.
+ */
+ WT_READ_BARRIER();
+
return (0);
}
@@ -319,6 +325,12 @@ __wt_fair_unlock(WT_SESSION_IMPL *session, WT_FAIR_LOCK *lock)
WT_UNUSED(session);
/*
+ * Ensure that all updates made while the lock was held are visible to
+ * the next thread to acquire the lock.
+ */
+ WT_WRITE_BARRIER();
+
+ /*
* We have exclusive access - the update does not need to be atomic.
*/
++lock->fair_lock_owner;