-
Notifications
You must be signed in to change notification settings - Fork 893
/
Copy pathopal_stdatomic.h
81 lines (55 loc) · 2.1 KB
/
opal_stdatomic.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2022 Amazon.com, Inc. or its affiliates.
* All Rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#if !defined(OPAL_STDATOMIC_H)
# define OPAL_STDATOMIC_H
# include "opal_stdint.h"
#if OPAL_USE_C11_ATOMICS == 0
typedef volatile int opal_atomic_int_t;
typedef volatile long opal_atomic_long_t;
typedef volatile int32_t opal_atomic_int32_t;
typedef volatile uint32_t opal_atomic_uint32_t;
typedef volatile int64_t opal_atomic_int64_t;
typedef volatile uint64_t opal_atomic_uint64_t;
typedef volatile size_t opal_atomic_size_t;
typedef volatile ssize_t opal_atomic_ssize_t;
typedef volatile intptr_t opal_atomic_intptr_t;
typedef volatile uintptr_t opal_atomic_uintptr_t;
typedef opal_atomic_int32_t opal_atomic_lock_t;
enum { OPAL_ATOMIC_LOCK_UNLOCKED = 0,
OPAL_ATOMIC_LOCK_LOCKED = 1 };
# define OPAL_ATOMIC_LOCK_INIT OPAL_ATOMIC_LOCK_UNLOCKED
#else /* OPAL_USE_C11_ATOMICS == 0 */
# include <stdatomic.h>
typedef atomic_int opal_atomic_int_t;
typedef atomic_long opal_atomic_long_t;
typedef _Atomic int32_t opal_atomic_int32_t;
typedef _Atomic uint32_t opal_atomic_uint32_t;
typedef _Atomic int64_t opal_atomic_int64_t;
typedef _Atomic uint64_t opal_atomic_uint64_t;
typedef _Atomic size_t opal_atomic_size_t;
typedef _Atomic ssize_t opal_atomic_ssize_t;
typedef _Atomic intptr_t opal_atomic_intptr_t;
typedef _Atomic uintptr_t opal_atomic_uintptr_t;
typedef atomic_flag opal_atomic_lock_t;
# define OPAL_ATOMIC_LOCK_UNLOCKED false
# define OPAL_ATOMIC_LOCK_LOCKED true
# define OPAL_ATOMIC_LOCK_INIT ATOMIC_FLAG_INIT
# endif /* OPAL_USE_C11_ATOMICS == 0 */
# if HAVE_OPAL_INT128_T
# if OPAL_USE_C11_ATOMICS && OPAL_HAVE_C11_CSWAP_INT128
typedef _Atomic opal_int128_t opal_atomic_int128_t;
# else
typedef volatile opal_int128_t opal_atomic_int128_t;
# endif
# endif
#endif /* !defined(OPAL_STDATOMIC_H) */