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

AK: Add default memory order as template argument for Atomic<T>

This is useful for collecting statistics, e.g.
Atomic<unsigned, MemoryOrder::memory_order_relaxed> would allow
using operators such as ++ to use relaxed semantics throughout
without having to explicitly call fetch_add with the memory order.
This commit is contained in:
Tom 2021-01-03 16:43:10 -07:00 committed by Andreas Kling
parent a6c459dd29
commit fb84f0ec9c
Notes: sideshowbarker 2024-07-19 00:07:15 +09:00
3 changed files with 38 additions and 30 deletions

View file

@ -102,3 +102,16 @@ enum class [[nodiscard]] TriState : u8 {
True,
Unknown
};
namespace AK {
enum MemoryOrder {
memory_order_relaxed = __ATOMIC_RELAXED,
memory_order_consume = __ATOMIC_CONSUME,
memory_order_acquire = __ATOMIC_ACQUIRE,
memory_order_release = __ATOMIC_RELEASE,
memory_order_acq_rel = __ATOMIC_ACQ_REL,
memory_order_seq_cst = __ATOMIC_SEQ_CST
};
}