Skip to content
Permalink
Browse files
MDEV-17441 - InnoDB transition to C++11 atomics
dict_table_t::n_ref_count transition to Atomic_counter.
  • Loading branch information
Sergey Vojtovich committed Dec 27, 2018
1 parent 5c657e9 commit 2e5d359
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
@@ -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. */

0 comments on commit 2e5d359

Please sign in to comment.