Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
atomic.h File Reference
#include <stdbool.h>
#include <toolchain.h>
#include <stddef.h>
#include <zephyr/types.h>
#include <sys/atomic_builtin.h>

Go to the source code of this file.

Macros

#define ATOMIC_INIT(i)   (i)
 Initialize an atomic variable. More...
 
#define ATOMIC_PTR_INIT(p)   (p)
 Initialize an atomic pointer variable. More...
 
#define ATOMIC_BITMAP_SIZE(num_bits)   (1 + ((num_bits) - 1) / ATOMIC_BITS)
 This macro computes the number of atomic variables necessary to represent a bitmap with num_bits. More...
 
#define ATOMIC_DEFINE(name, num_bits)    atomic_t name[ATOMIC_BITMAP_SIZE(num_bits)]
 Define an array of atomic variables. More...
 

Typedefs

typedef int atomic_t
 
typedef atomic_t atomic_val_t
 
typedef voidatomic_ptr_t
 
typedef atomic_ptr_t atomic_ptr_val_t
 

Functions

static bool atomic_test_bit (const atomic_t *target, int bit)
 Atomically test a bit. More...
 
static bool atomic_test_and_clear_bit (atomic_t *target, int bit)
 Atomically test and clear a bit. More...
 
static bool atomic_test_and_set_bit (atomic_t *target, int bit)
 Atomically set a bit. More...
 
static void atomic_clear_bit (atomic_t *target, int bit)
 Atomically clear a bit. More...
 
static void atomic_set_bit (atomic_t *target, int bit)
 Atomically set a bit. More...
 
static void atomic_set_bit_to (atomic_t *target, int bit, bool val)
 Atomically set a bit to a given value. More...
 

Typedef Documentation

◆ atomic_ptr_t

typedef void* atomic_ptr_t

◆ atomic_ptr_val_t

◆ atomic_t

typedef int atomic_t

◆ atomic_val_t