ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
util/atomic.h
Go to the documentation of this file.
1
33#pragma once
34
35#include <ascii-chat/atomic.h>
36#include <stdbool.h>
37#include <stdint.h>
38
56#define SHOULD_EXIT() (atomic_load(&g_should_exit))
57
73#define CLIENT_SHOULD_EXIT() (atomic_load(&g_should_exit))
74
86#define ATOMIC_LOAD_BOOL(ptr) atomic_load((atomic_t *)(ptr))
87
99#define ATOMIC_LOAD_UINT32(ptr) atomic_load((atomic_uint32_t *)(ptr))
100
112#define ATOMIC_LOAD_UINT64(ptr) atomic_load((atomic_uint64_t *)(ptr))
113
125#define ATOMIC_STORE_BOOL(ptr, value) atomic_store((atomic_t *)(ptr), (value))
126
138#define ATOMIC_STORE_UINT32(ptr, value) atomic_store((atomic_uint32_t *)(ptr), (value))
139
151#define ATOMIC_STORE_UINT64(ptr, value) atomic_store((atomic_uint64_t *)(ptr), (value))
152
173#define ATOMIC_CAS_BOOL(ptr, expected, new_value) \
174 atomic_compare_exchange_strong((atomic_t *)(ptr), &(expected), (new_value))
175
192#define ATOMIC_CAS_UINT32(ptr, expected, new_value) \
193 atomic_compare_exchange_strong((atomic_uint32_t *)(ptr), (expected), (new_value))
194
208#define ATOMIC_ADD_UINT32(ptr, delta) atomic_fetch_add((atomic_uint32_t *)(ptr), (delta))
209
223#define ATOMIC_SUB_UINT32(ptr, delta) atomic_fetch_sub((atomic_uint32_t *)(ptr), (delta))
224
225#endif
⚛️ Atomic operations abstraction layer with debug tracking
ClangTool/LibTooling compatibility shim for stdbool.h.