summaryrefslogtreecommitdiff
path: root/src/include/mutex.i
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/mutex.i')
-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;