|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
Go to the source code of this file.
Macros | |
| #define | SHOULD_EXIT() (atomic_load(&g_server_should_exit)) |
| #define | CLIENT_SHOULD_EXIT() (atomic_load(&g_should_exit)) |
| #define | ATOMIC_LOAD_BOOL(ptr) atomic_load((atomic_bool *)(ptr)) |
| #define | ATOMIC_LOAD_UINT32(ptr) atomic_load((atomic_uint32_t *)(ptr)) |
| #define | ATOMIC_LOAD_UINT64(ptr) atomic_load((atomic_uint64_t *)(ptr)) |
| #define | ATOMIC_STORE_BOOL(ptr, value) atomic_store((atomic_bool *)(ptr), (value)) |
| #define | ATOMIC_STORE_UINT32(ptr, value) atomic_store((atomic_uint32_t *)(ptr), (value)) |
| #define | ATOMIC_STORE_UINT64(ptr, value) atomic_store((atomic_uint64_t *)(ptr), (value)) |
| #define | ATOMIC_CAS_BOOL(ptr, expected, new_value) atomic_compare_exchange_strong((atomic_bool *)(ptr), &(expected), (new_value)) |
| #define | ATOMIC_CAS_UINT32(ptr, expected, new_value) atomic_compare_exchange_strong((atomic_uint32_t *)(ptr), (expected), (new_value)) |
| #define | ATOMIC_ADD_UINT32(ptr, delta) atomic_fetch_add((atomic_uint32_t *)(ptr), (delta)) |
| #define | ATOMIC_SUB_UINT32(ptr, delta) atomic_fetch_sub((atomic_uint32_t *)(ptr), (delta)) |
| #define ATOMIC_ADD_UINT32 | ( | ptr, | |
| delta | |||
| ) | atomic_fetch_add((atomic_uint32_t *)(ptr), (delta)) |
Atomically add to an unsigned 32-bit value.
| ptr | Pointer to atomic_uint32_t variable |
| delta | Value to add |
Usage:
| #define ATOMIC_CAS_BOOL | ( | ptr, | |
| expected, | |||
| new_value | |||
| ) | atomic_compare_exchange_strong((atomic_bool *)(ptr), &(expected), (new_value)) |
Compare and swap operation for boolean atomics. Atomically compares the value at ptr with expected, and if equal, stores new_value and returns true. Otherwise returns false.
| ptr | Pointer to atomic_bool variable |
| expected | Expected value |
| new_value | New value to store if comparison succeeds |
Usage:
| #define ATOMIC_CAS_UINT32 | ( | ptr, | |
| expected, | |||
| new_value | |||
| ) | atomic_compare_exchange_strong((atomic_uint32_t *)(ptr), (expected), (new_value)) |
Compare and swap operation for unsigned 32-bit atomics.
| ptr | Pointer to atomic_uint32_t variable |
| expected | Expected value (passed by reference) |
| new_value | New value to store if comparison succeeds |
Usage:
| #define ATOMIC_LOAD_BOOL | ( | ptr | ) | atomic_load((atomic_bool *)(ptr)) |
Safely load a boolean atomic value.
| ptr | Pointer to atomic_bool variable |
Usage:
| #define ATOMIC_LOAD_UINT32 | ( | ptr | ) | atomic_load((atomic_uint32_t *)(ptr)) |
Safely load an unsigned 32-bit atomic value.
| ptr | Pointer to atomic_uint32_t variable |
Usage:
| #define ATOMIC_LOAD_UINT64 | ( | ptr | ) | atomic_load((atomic_uint64_t *)(ptr)) |
Safely load an unsigned 64-bit atomic value.
| ptr | Pointer to atomic_uint64_t variable |
Usage:
| #define ATOMIC_STORE_BOOL | ( | ptr, | |
| value | |||
| ) | atomic_store((atomic_bool *)(ptr), (value)) |
Safely store a boolean atomic value.
| ptr | Pointer to atomic_bool variable |
| value | Value to store |
Usage:
| #define ATOMIC_STORE_UINT32 | ( | ptr, | |
| value | |||
| ) | atomic_store((atomic_uint32_t *)(ptr), (value)) |
Safely store an unsigned 32-bit atomic value.
| ptr | Pointer to atomic_uint32_t variable |
| value | Value to store |
Usage:
| #define ATOMIC_STORE_UINT64 | ( | ptr, | |
| value | |||
| ) | atomic_store((atomic_uint64_t *)(ptr), (value)) |
Safely store an unsigned 64-bit atomic value.
| ptr | Pointer to atomic_uint64_t variable |
| value | Value to store |
Usage:
| #define ATOMIC_SUB_UINT32 | ( | ptr, | |
| delta | |||
| ) | atomic_fetch_sub((atomic_uint32_t *)(ptr), (delta)) |
Atomically subtract from an unsigned 32-bit value.
| ptr | Pointer to atomic_uint32_t variable |
| delta | Value to subtract |
Usage:
| #define CLIENT_SHOULD_EXIT | ( | ) | (atomic_load(&g_should_exit)) |
Check if the global client should exit. Requires g_should_exit to be declared as atomic_bool in the compilation unit.
Usage:
| #define SHOULD_EXIT | ( | ) | (atomic_load(&g_server_should_exit)) |
Check if the global server should exit. Requires g_server_should_exit to be declared as atomic_bool in the compilation unit.
Usage: