Simple atomic uint32_t API (get, set, increment, decrement). More...
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | sys_atomic_t |
Underlying atomic uint32_t value. More... | |
Functions | |
struct sys_atomic_t | __attribute__ ((aligned(4))) |
Underlying atomic uint32_t value. More... | |
static void | sys_atomic_init (sys_atomic_t *a, uint32_t initial) |
Initialize an atomic with an initial value. More... | |
static uint32_t | sys_atomic_get (const sys_atomic_t *a) |
Load the current value atomically. More... | |
static void | sys_atomic_set (sys_atomic_t *a, uint32_t v) |
Store a new value atomically. More... | |
static uint32_t | sys_atomic_inc (sys_atomic_t *a) |
Atomically increment and return the new value. More... | |
static uint32_t | sys_atomic_dec (sys_atomic_t *a) |
Atomically decrement and return the new value. More... | |
static void | sys_atomic_set_bits (sys_atomic_t *a, uint32_t mask) |
Atomically set bits (OR with mask). More... | |
static void | sys_atomic_clear_bits (sys_atomic_t *a, uint32_t mask) |
Atomically clear bits (AND with ~mask). More... | |
Variables | |
uint32_t | value |
Simple atomic uint32_t API (get, set, increment, decrement).
Implements atomic values which can be safely updated across threads.
This API allows you to maintain a uint32_t value across threads safely. The operations are to get, set, increment and decrement. For the increment and decrement operations return the new value.
Definition in file atomic.h.