summaryrefslogtreecommitdiff
path: root/storage/xtradb/sync/sync0sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb/sync/sync0sync.c')
-rw-r--r--storage/xtradb/sync/sync0sync.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/storage/xtradb/sync/sync0sync.c b/storage/xtradb/sync/sync0sync.c
index 25f96d9817a..948d211bc03 100644
--- a/storage/xtradb/sync/sync0sync.c
+++ b/storage/xtradb/sync/sync0sync.c
@@ -44,6 +44,7 @@ Created 9/5/1995 Heikki Tuuri
# include "srv0start.h" /* srv_is_being_started */
#endif /* UNIV_SYNC_DEBUG */
#include "ha_prototypes.h"
+#include "my_cpu.h"
/*
REASONS FOR IMPLEMENTING THE SPIN LOCK MUTEX
@@ -481,6 +482,8 @@ mutex_set_waiters(
ptr = &(mutex->waiters);
+ os_wmb;
+
*ptr = n; /* Here we assume that the write of a single
word in memory is atomic */
#endif
@@ -523,13 +526,15 @@ mutex_loop:
spin_loop:
ut_d(mutex->count_spin_loop++);
+ HMT_low();
while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS) {
if (srv_spin_wait_delay) {
ut_delay(ut_rnd_interval(0, srv_spin_wait_delay));
}
-
+ os_rmb; // Ensure future reads sees new values
i++;
}
+ HMT_medium();
if (i == SYNC_SPIN_ROUNDS) {
#ifdef UNIV_DEBUG