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:
parent
a6c459dd29
commit
fb84f0ec9c
Notes:
sideshowbarker
2024-07-19 00:07:15 +09:00
Author: https://github.com/tomuta
Commit: fb84f0ec9c
Pull-request: https://github.com/SerenityOS/serenity/pull/4783
3 changed files with 38 additions and 30 deletions
13
AK/Types.h
13
AK/Types.h
|
@ -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
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue