1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00: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
12 changed files with 44 additions and 43 deletions

View file

@ -67,9 +67,9 @@ public:
VMObject* m_next { nullptr };
VMObject* m_prev { nullptr };
ALWAYS_INLINE void ref_region() { m_regions_count.fetch_add(1, AK::MemoryOrder::memory_order_relaxed); }
ALWAYS_INLINE void unref_region() { m_regions_count.fetch_sub(1, AK::MemoryOrder::memory_order_relaxed); }
ALWAYS_INLINE bool is_shared_by_multiple_regions() const { return m_regions_count.load(AK::MemoryOrder::memory_order_relaxed) > 1; }
ALWAYS_INLINE void ref_region() { m_regions_count++; }
ALWAYS_INLINE void unref_region() { m_regions_count--; }
ALWAYS_INLINE bool is_shared_by_multiple_regions() const { return m_regions_count > 1; }
protected:
explicit VMObject(size_t);
@ -88,7 +88,7 @@ private:
VMObject& operator=(VMObject&&) = delete;
VMObject(VMObject&&) = delete;
Atomic<u32> m_regions_count { 0 };
Atomic<u32, AK::MemoryOrder::memory_order_relaxed> m_regions_count { 0 };
};
}