summaryrefslogtreecommitdiff
path: root/storage/xtradb/include/sync0sync.ic
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-11-20 15:26:31 +0100
committerSergei Golubchik <sergii@pisem.net>2014-11-20 15:26:31 +0100
commitafca52bb52cec4cd0f8167b905eab63def8f0ad2 (patch)
tree67b39aeace1d2c45eef90cbbe0d96769eeae294d /storage/xtradb/include/sync0sync.ic
parent3495801e2e94df5a10cae6e056f65defa038a6b6 (diff)
parent6ea41f1e84eb6b864cac17ad0b862bde9820dc33 (diff)
downloadmariadb-git-afca52bb52cec4cd0f8167b905eab63def8f0ad2.tar.gz
5.5 merge
Diffstat (limited to 'storage/xtradb/include/sync0sync.ic')
-rw-r--r--storage/xtradb/include/sync0sync.ic18
1 files changed, 7 insertions, 11 deletions
diff --git a/storage/xtradb/include/sync0sync.ic b/storage/xtradb/include/sync0sync.ic
index 6bd80ee7dea..a641ef8bb9e 100644
--- a/storage/xtradb/include/sync0sync.ic
+++ b/storage/xtradb/include/sync0sync.ic
@@ -83,15 +83,11 @@ ib_mutex_test_and_set(
ib_mutex_t* mutex) /*!< in: mutex */
{
#if defined(HAVE_ATOMIC_BUILTINS)
-# if defined(HAVE_ATOMIC_BUILTINS_BYTE)
- return(os_atomic_test_and_set_byte(&mutex->lock_word, 1));
-# else
- return(os_atomic_test_and_set_ulint(&mutex->lock_word, 1));
-# endif
+ return(os_atomic_test_and_set_byte_acquire(&mutex->lock_word, 1));
#else
ibool ret;
- ret = os_fast_mutex_trylock(&(mutex->os_fast_mutex));
+ ret = os_fast_mutex_trylock_full_barrier(&(mutex->os_fast_mutex));
if (ret == 0) {
/* We check that os_fast_mutex_trylock does not leak
@@ -99,7 +95,6 @@ ib_mutex_test_and_set(
ut_a(mutex->lock_word == 0);
mutex->lock_word = 1;
- os_wmb;
}
return((byte) ret);
@@ -116,11 +111,14 @@ mutex_reset_lock_word(
ib_mutex_t* mutex) /*!< in: mutex */
{
#if defined(HAVE_ATOMIC_BUILTINS)
- os_atomic_lock_release_byte(&mutex->lock_word);
+ /* In theory __sync_lock_release should be used to release the lock.
+ Unfortunately, it does not work properly alone. The workaround is
+ that more conservative __sync_lock_test_and_set is used instead. */
+ os_atomic_test_and_set_byte_release(&mutex->lock_word, 0);
#else
mutex->lock_word = 0;
- os_fast_mutex_unlock(&(mutex->os_fast_mutex));
+ os_fast_mutex_unlock_full_barrier(&(mutex->os_fast_mutex));
#endif
}
@@ -152,7 +150,6 @@ mutex_get_waiters(
ptr = &(mutex->waiters);
- os_rmb;
return(*ptr); /* Here we assume that the read of a single
word from memory is atomic */
}
@@ -187,7 +184,6 @@ mutex_exit_func(
to wake up possible hanging threads if
they are missed in mutex_signal_object. */
- os_isync;
if (mutex_get_waiters(mutex) != 0) {
mutex_signal_object(mutex);