1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

Kernel: Specify default memory order for some non-synchronizing Atomics

This commit is contained in:
Tom 2021-01-03 16:58:50 -07:00 committed by Andreas Kling
parent fb84f0ec9c
commit 901ef3f1c8
Notes: sideshowbarker 2024-07-19 00:07:11 +09:00
12 changed files with 44 additions and 43 deletions

View file

@ -58,7 +58,7 @@ public:
void unlock();
[[nodiscard]] Mode force_unlock_if_locked(u32&);
void restore_lock(Mode, u32);
bool is_locked() const { return m_mode.load(AK::MemoryOrder::memory_order_relaxed) != Mode::Unlocked; }
bool is_locked() const { return m_mode != Mode::Unlocked; }
void clear_waiters();
const char* name() const { return m_name; }
@ -81,7 +81,7 @@ private:
Atomic<bool> m_lock { false };
const char* m_name { nullptr };
WaitQueue m_queue;
Atomic<Mode> m_mode { Mode::Unlocked };
Atomic<Mode, AK::MemoryOrder::memory_order_relaxed> m_mode { Mode::Unlocked };
// When locked exclusively, only the thread already holding the lock can
// lock it again. When locked in shared mode, any thread can do that.