API Reference Manual 1.51.0
Loading...
Searching...
No Matches
api/abi-default/atomic.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2015-2018 Linaro Limited
3 * Copyright (c) 2021 ARM Limited
4 */
5
12#ifndef ODP_ABI_ATOMIC_H_
13#define ODP_ABI_ATOMIC_H_
14
15#include <odp/api/std_types.h>
16#include <odp/api/align.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
26typedef struct ODP_ALIGNED(sizeof(uint32_t)) odp_atomic_u32_s {
27 uint32_t v;
29
30#if __GCC_ATOMIC_LLONG_LOCK_FREE >= 2
31
36typedef struct ODP_ALIGNED(sizeof(uint64_t)) odp_atomic_u64_s {
37 uint64_t v;
39
40#else
41
46#define ODP_ATOMIC_U64_LOCK 1
47
52typedef struct ODP_ALIGNED(sizeof(uint64_t)) odp_atomic_u64_s {
53 uint64_t v;
54 /* Some architectures do not support lock-free operations on 64-bit
55 * data types. We use a spin lock to ensure atomicity. */
56 char lock;
58
59#endif
60
61#if defined(__SIZEOF_INT128__) || defined(_ODP_LOCK_FREE_128BIT_ATOMICS)
62
67typedef struct ODP_ALIGNED(sizeof(odp_u128_t)) odp_atomic_u128_s {
68 odp_u128_t v;
70
71#else
72
77typedef struct ODP_ALIGNED(sizeof(odp_u128_t)) odp_atomic_u128_s {
79 /* Some architectures do not support lock-free operations on 128-bit
80 * data types. We use a spin lock to ensure atomicity. */
81 char lock;
83
84#endif
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif
struct odp_atomic_u128_s odp_atomic_u128_t
struct odp_atomic_u32_s odp_atomic_u32_t
struct odp_atomic_u64_s odp_atomic_u64_t
ODP alignments.
Standard C language types and definitions for ODP.
#define ODP_ALIGNED(x)
Defines type/struct/variable alignment in bytes.
odp_u128_t v
Actual storage for the atomic variable.
char lock
Spin lock (if needed) used to ensure atomic access.
uint32_t v
Actual storage for the atomic variable.
uint64_t v
Actual storage for the atomic variable.
char lock
Spin lock (if needed) used to ensure atomic access.
128-bit unsigned integer structure