Skip to content
Permalink
Browse files
MDEV-17441 - InnoDB transition to C++11 atomics
trx_t::n_ref transition to Atomic_counter.
  • Loading branch information
Sergey Vojtovich committed Dec 27, 2018
1 parent 4abdd79 commit 67dbfe6
Showing 1 changed file with 6 additions and 6 deletions.
@@ -773,7 +773,7 @@ struct trx_t {
that it is no longer "active".
*/

int32_t n_ref;
Atomic_counter<int32_t> n_ref;


public:
@@ -1119,26 +1119,26 @@ struct trx_t {

bool is_referenced()
{
return my_atomic_load32_explicit(&n_ref, MY_MEMORY_ORDER_RELAXED) > 0;
return n_ref > 0;
}


void reference()
{
#ifdef UNIV_DEBUG
int32_t old_n_ref=
auto old_n_ref=
#endif
my_atomic_add32_explicit(&n_ref, 1, MY_MEMORY_ORDER_RELAXED);
n_ref++;
ut_ad(old_n_ref >= 0);
}


void release_reference()
{
#ifdef UNIV_DEBUG
int32_t old_n_ref=
auto old_n_ref=
#endif
my_atomic_add32_explicit(&n_ref, -1, MY_MEMORY_ORDER_RELAXED);
n_ref--;
ut_ad(old_n_ref > 0);
}

0 comments on commit 67dbfe6

Please sign in to comment.