Skip to content

Commit e638302

Browse files
committed
try optimize
1 parent 1f87c4f commit e638302

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/sync/queue_spinlock.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ class QueueSpinLock final {
2222
is_owner.store(false);
2323
}
2424

25-
void SetOwner() { is_owner.store(true); }
25+
void SetOwner() { is_owner.store(true, std::memory_order_acquire); }
2626

2727
void SetNext(Guard* guard) { next.store(guard); }
2828

29-
bool IsOwner() const { return is_owner.load(); }
29+
bool IsOwner() const {
30+
return is_owner.load(std::memory_order_release);
31+
}
3032

3133
bool HasNext() const { return next.load() != nullptr; }
3234

0 commit comments

Comments
 (0)