Commit 67dbfe6e authored by Sergey Vojtovich's avatar Sergey Vojtovich

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

trx_t::n_ref transition to Atomic_counter.
parent 4abdd798
...@@ -773,7 +773,7 @@ struct trx_t { ...@@ -773,7 +773,7 @@ struct trx_t {
that it is no longer "active". that it is no longer "active".
*/ */
int32_t n_ref; Atomic_counter<int32_t> n_ref;
public: public:
...@@ -1119,16 +1119,16 @@ struct trx_t { ...@@ -1119,16 +1119,16 @@ struct trx_t {
bool is_referenced() bool is_referenced()
{ {
return my_atomic_load32_explicit(&n_ref, MY_MEMORY_ORDER_RELAXED) > 0; return n_ref > 0;
} }
void reference() void reference()
{ {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
int32_t old_n_ref= auto old_n_ref=
#endif #endif
my_atomic_add32_explicit(&n_ref, 1, MY_MEMORY_ORDER_RELAXED); n_ref++;
ut_ad(old_n_ref >= 0); ut_ad(old_n_ref >= 0);
} }
...@@ -1136,9 +1136,9 @@ struct trx_t { ...@@ -1136,9 +1136,9 @@ struct trx_t {
void release_reference() void release_reference()
{ {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
int32_t old_n_ref= auto old_n_ref=
#endif #endif
my_atomic_add32_explicit(&n_ref, -1, MY_MEMORY_ORDER_RELAXED); n_ref--;
ut_ad(old_n_ref > 0); ut_ad(old_n_ref > 0);
} }
......
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