Skip to content

Commit 362a277

Browse files
committed
up mm
1 parent d36baaf commit 362a277

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/components/sync/queue_spinlock.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class QueueSpinLock final {
1414
public:
1515
explicit Guard(QueueSpinLock& host) : host(host) { host.Acquire(this); }
1616
~Guard() {
17-
if (is_owner.load()) Release();
17+
if (is_owner.load(std::memory_order_release)) Release();
1818
}
1919

2020
void Release() {
@@ -24,13 +24,13 @@ class QueueSpinLock final {
2424

2525
void SetOwner() { is_owner.store(true, std::memory_order_release); }
2626

27-
void SetNext(Guard* guard) { next.store(guard); }
27+
void SetNext(Guard* guard) { next.store(guard, std::memory_order_release); }
2828

2929
bool IsOwner() const {
3030
return is_owner.load(std::memory_order_acquire);
3131
}
3232

33-
bool HasNext() const { return next.load() != nullptr; }
33+
bool HasNext() const { return next.load(std::memory_order_acquire) != nullptr; }
3434

3535
void SetNextOwner() { next.load()->SetOwner(); }
3636

@@ -60,8 +60,8 @@ class QueueSpinLock final {
6060
}
6161

6262
Guard* old_guard = guard;
63-
while (!tail_.compare_exchange_weak(old_guard, nullptr,
64-
std::memory_order_release)) {
63+
while (!tail_.compare_exchange_weak(old_guard, nullptr/*,
64+
std::memory_order_release*/)) {
6565
if (guard->HasNext()) {
6666
guard->SetNextOwner();
6767
return;

0 commit comments

Comments
 (0)