Skip to content

Commit 67dbfe6

Browse files
committed
MDEV-17441 - InnoDB transition to C++11 atomics
trx_t::n_ref transition to Atomic_counter.
1 parent 4abdd79 commit 67dbfe6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

storage/innobase/include/trx0trx.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ struct trx_t {
773773
that it is no longer "active".
774774
*/
775775

776-
int32_t n_ref;
776+
Atomic_counter<int32_t> n_ref;
777777

778778

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

11201120
bool is_referenced()
11211121
{
1122-
return my_atomic_load32_explicit(&n_ref, MY_MEMORY_ORDER_RELAXED) > 0;
1122+
return n_ref > 0;
11231123
}
11241124

11251125

11261126
void reference()
11271127
{
11281128
#ifdef UNIV_DEBUG
1129-
int32_t old_n_ref=
1129+
auto old_n_ref=
11301130
#endif
1131-
my_atomic_add32_explicit(&n_ref, 1, MY_MEMORY_ORDER_RELAXED);
1131+
n_ref++;
11321132
ut_ad(old_n_ref >= 0);
11331133
}
11341134

11351135

11361136
void release_reference()
11371137
{
11381138
#ifdef UNIV_DEBUG
1139-
int32_t old_n_ref=
1139+
auto old_n_ref=
11401140
#endif
1141-
my_atomic_add32_explicit(&n_ref, -1, MY_MEMORY_ORDER_RELAXED);
1141+
n_ref--;
11421142
ut_ad(old_n_ref > 0);
11431143
}
11441144

0 commit comments

Comments
 (0)