Commit 2e5d3596 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-17441 - InnoDB transition to C++11 atomics

dict_table_t::n_ref_count transition to Atomic_counter.
parent 5c657e9f
......@@ -437,7 +437,7 @@ dict_table_try_drop_aborted(
dict_table_t* table, /*!< in: table, or NULL if it
needs to be looked up again */
table_id_t table_id, /*!< in: table identifier */
int32 ref_count) /*!< in: expected table->n_ref_count */
uint32_t ref_count) /*!< in: expected table->n_ref_count */
{
trx_t* trx;
......
......@@ -1281,7 +1281,7 @@ void
dict_table_t::acquire()
{
ut_ad(mutex_own(&dict_sys->mutex));
my_atomic_add32_explicit(&n_ref_count, 1, MY_MEMORY_ORDER_RELAXED);
n_ref_count++;
}
/** Release the table handle.
......@@ -1290,8 +1290,7 @@ inline
bool
dict_table_t::release()
{
int32 n = my_atomic_add32_explicit(
&n_ref_count, -1, MY_MEMORY_ORDER_RELAXED);
auto n = n_ref_count--;
ut_ad(n > 0);
return n == 1;
}
......
......@@ -1615,11 +1615,7 @@ struct dict_table_t {
/** Get reference count.
@return current value of n_ref_count */
inline int32 get_ref_count()
{
return my_atomic_load32_explicit(&n_ref_count,
MY_MEMORY_ORDER_RELAXED);
}
inline uint32_t get_ref_count() const { return n_ref_count; }
/** Acquire the table handle. */
inline void acquire();
......@@ -2139,7 +2135,7 @@ struct dict_table_t {
/** Count of how many handles are opened to this table. Dropping of the
table is NOT allowed until this count gets to zero. MySQL does NOT
itself check the number of open handles at DROP. */
int32 n_ref_count;
Atomic_counter<uint32_t> n_ref_count;
public:
/** List of locks on the table. Protected by lock_sys.mutex. */
......
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