vsync / atomic / core_ptr.h
Atomic functions for vatomicptr_t variables.
This file declares and documents the core atomic functions operating on vatomicptr_t variables.
Please do not include this file directly, instead use:
#include <vsync/atomic/core.h>
Functions
| Function | Description |
|---|---|
| vatomicptr_init | Initializes the atomic variable a with value v. |
| vatomicptr_read | Returns the value of the atomic variable pointed by a. |
| vatomicptr_read_acq | Returns the value of the atomic variable pointed by a. |
| vatomicptr_read_rlx | Returns the value of the atomic variable pointed by a. |
| vatomicptr_write | Writes value v in the atomic variable pointed by a. |
| vatomicptr_write_rel | Writes value v in the atomic variable pointed by a. |
| vatomicptr_write_rlx | Writes value v in the atomic variable pointed by a. |
| vatomicptr_xchg | Writes v in a and returns old value. |
| vatomicptr_xchg_acq | Writes v in a and returns old value. |
| vatomicptr_xchg_rel | Writes v in a and returns old value. |
| vatomicptr_xchg_rlx | Writes v in a and returns old value. |
| vatomicptr_cmpxchg | Writes value v in a if e is the current value. |
| vatomicptr_cmpxchg_acq | Writes value v in a if e is the current value. |
| vatomicptr_cmpxchg_rel | Writes value v in a if e is the current value. |
| vatomicptr_cmpxchg_rlx | Writes value v in a if e is the current value. |
Function vatomicptr_init
static void vatomicptr_init(vatomicptr_t *a, void *v)
Initializes the atomic variable a with value v.
The initialization is equivalent to an vatomicptr_write().
Parameters:
a: atomic variablev: initial value
Memory ordering: seq_cst
Function vatomicptr_read
static void* vatomicptr_read(const vatomicptr_t *a)
Returns the value of the atomic variable pointed by a.
Parameters:
a: atomic variable
Returns: current value
Memory ordering: seq_cst
Function vatomicptr_read_acq
static void* vatomicptr_read_acq(const vatomicptr_t *a)
Returns the value of the atomic variable pointed by a.
Parameters:
a: atomic variable
Returns: current value
Memory ordering: acquire
Function vatomicptr_read_rlx
static void* vatomicptr_read_rlx(const vatomicptr_t *a)
Returns the value of the atomic variable pointed by a.
Parameters:
a: atomic variable
Returns: current value
Memory ordering: relaxed
Function vatomicptr_write
static void vatomicptr_write(vatomicptr_t *a, void *v)
Writes value v in the atomic variable pointed by a.
Parameters:
a: atomic variablev: new value
Memory ordering: seq_cst
Function vatomicptr_write_rel
static void vatomicptr_write_rel(vatomicptr_t *a, void *v)
Writes value v in the atomic variable pointed by a.
Parameters:
a: atomic variablev: new value
Memory ordering: release
Function vatomicptr_write_rlx
static void vatomicptr_write_rlx(vatomicptr_t *a, void *v)
Writes value v in the atomic variable pointed by a.
Parameters:
a: atomic variablev: new value
Memory ordering: relaxed
Function vatomicptr_xchg
static void* vatomicptr_xchg(vatomicptr_t *a, void *v)
Writes v in a and returns old value.
Parameters:
a: atomic variablev: new value
Returns: old value
Memory ordering: seq_cst
Function vatomicptr_xchg_acq
static void* vatomicptr_xchg_acq(vatomicptr_t *a, void *v)
Writes v in a and returns old value.
Parameters:
a: atomic variablev: new value
Returns: old value
Memory ordering: acquire
Function vatomicptr_xchg_rel
static void* vatomicptr_xchg_rel(vatomicptr_t *a, void *v)
Writes v in a and returns old value.
Parameters:
a: atomic variablev: new value
Returns: old value
Memory ordering: release
Function vatomicptr_xchg_rlx
static void* vatomicptr_xchg_rlx(vatomicptr_t *a, void *v)
Writes v in a and returns old value.
Parameters:
a: atomic variablev: new value
Returns: old value
Memory ordering: relaxed
Function vatomicptr_cmpxchg
static void* vatomicptr_cmpxchg(vatomicptr_t *a, void *e, void *v)
Writes value v in a if e is the current value.
Parameters:
a: atomic variablee: expected valuev: new value
Returns: old value
Function vatomicptr_cmpxchg_acq
static void* vatomicptr_cmpxchg_acq(vatomicptr_t *a, void *e, void *v)
Writes value v in a if e is the current value.
Parameters:
a: atomic variablee: expected valuev: new value
Returns: old value
Function vatomicptr_cmpxchg_rel
static void* vatomicptr_cmpxchg_rel(vatomicptr_t *a, void *e, void *v)
Writes value v in a if e is the current value.
Parameters:
a: atomic variablee: expected valuev: new value
Returns: old value
Function vatomicptr_cmpxchg_rlx
static void* vatomicptr_cmpxchg_rlx(vatomicptr_t *a, void *e, void *v)
Writes value v in a if e is the current value.
Parameters:
a: atomic variablee: expected valuev: new value
Returns: old value