mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 19:00:14 -05:00
k_auto_object: Fix data race
Change the memory order to acqure-release when we decrement the reference count. Prevents a race with line 89 reported by TSan.
This commit is contained in:
parent
6bcbbb29e7
commit
983916e919
1 changed files with 1 additions and 1 deletions
|
@ -163,7 +163,7 @@ public:
|
||||||
do {
|
do {
|
||||||
ASSERT(cur_ref_count > 0);
|
ASSERT(cur_ref_count > 0);
|
||||||
} while (!m_ref_count.compare_exchange_weak(cur_ref_count, cur_ref_count - 1,
|
} while (!m_ref_count.compare_exchange_weak(cur_ref_count, cur_ref_count - 1,
|
||||||
std::memory_order_relaxed));
|
std::memory_order_acq_rel));
|
||||||
|
|
||||||
// If ref count hits zero, destroy the object.
|
// If ref count hits zero, destroy the object.
|
||||||
if (cur_ref_count - 1 == 0) {
|
if (cur_ref_count - 1 == 0) {
|
||||||
|
|
Loading…
Reference in a new issue