Commit 93e6f388 authored by Shaohua Wang's avatar Shaohua Wang

Followup:BUG#22530768 Innodb freeze running REPLACE statements

Go back to __sync_* operations in TAS on x86.

Patch is reviewed by Sunny over IM.
parent a204ce5b
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
...@@ -318,28 +318,7 @@ amount of increment. */ ...@@ -318,28 +318,7 @@ amount of increment. */
# define os_atomic_increment_ulint(ptr, amount) \ # define os_atomic_increment_ulint(ptr, amount) \
os_atomic_increment(ptr, amount) os_atomic_increment(ptr, amount)
# if defined(HAVE_IB_GCC_ATOMIC_TEST_AND_SET) # if defined(IB_STRONG_MEMORY_MODEL)
/** Do an atomic test-and-set.
@param[in,out] ptr Memory location to set to non-zero
@return the previous value */
static inline
lock_word_t
os_atomic_test_and_set(volatile lock_word_t* ptr)
{
return(__atomic_test_and_set(ptr, __ATOMIC_ACQUIRE));
}
/** Do an atomic clear.
@param[in,out] ptr Memory location to set to zero */
static inline
void
os_atomic_clear(volatile lock_word_t* ptr)
{
__atomic_clear(ptr, __ATOMIC_RELEASE);
}
# elif defined(IB_STRONG_MEMORY_MODEL)
/** Do an atomic test and set. /** Do an atomic test and set.
@param[in,out] ptr Memory location to set to non-zero @param[in,out] ptr Memory location to set to non-zero
...@@ -368,6 +347,27 @@ os_atomic_clear(volatile lock_word_t* ptr) ...@@ -368,6 +347,27 @@ os_atomic_clear(volatile lock_word_t* ptr)
return(__sync_lock_test_and_set(ptr, 0)); return(__sync_lock_test_and_set(ptr, 0));
} }
# elif defined(HAVE_IB_GCC_ATOMIC_TEST_AND_SET)
/** Do an atomic test-and-set.
@param[in,out] ptr Memory location to set to non-zero
@return the previous value */
static inline
lock_word_t
os_atomic_test_and_set(volatile lock_word_t* ptr)
{
return(__atomic_test_and_set(ptr, __ATOMIC_ACQUIRE));
}
/** Do an atomic clear.
@param[in,out] ptr Memory location to set to zero */
static inline
void
os_atomic_clear(volatile lock_word_t* ptr)
{
__atomic_clear(ptr, __ATOMIC_RELEASE);
}
# else # else
# error "Unsupported platform" # error "Unsupported platform"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment