Embedded Template Library 1.0
Loading...
Searching...
No Matches
atomic_std.h
1/******************************************************************************
2The MIT License(MIT)
3
4Embedded Template Library.
5https://github.com/ETLCPP/etl
6https://www.etlcpp.com
7
8Copyright(c) 2018 John Wellbelove
9
10Permission is hereby granted, free of charge, to any person obtaining a copy
11of this software and associated documentation files(the "Software"), to deal
12in the Software without restriction, including without limitation the rights
13to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
14copies of the Software, and to permit persons to whom the Software is
15furnished to do so, subject to the following conditions :
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
23AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26SOFTWARE.
27******************************************************************************/
28
29#ifndef ETL_ATOMIC_STD_INCLUDED
30#define ETL_ATOMIC_STD_INCLUDED
31
32#include "../platform.h"
33#include "../nullptr.h"
34#include "../char_traits.h"
35
36#include <atomic>
37#include <stdint.h>
38
39namespace etl
40{
41 //***************************************************************************
42 // ETL Atomic type for compilers that support std::atomic.
43 // etl::atomic is a simple wrapper around std::atomic.
44 //***************************************************************************
45
46 template <typename T>
47 using atomic = std::atomic<T>;
48
49 using memory_order = std::memory_order;
50
51 static ETL_CONSTANT etl::memory_order memory_order_relaxed = std::memory_order_relaxed;
52 static ETL_CONSTANT etl::memory_order memory_order_consume = std::memory_order_consume;
53 static ETL_CONSTANT etl::memory_order memory_order_acquire = std::memory_order_acquire;
54 static ETL_CONSTANT etl::memory_order memory_order_release = std::memory_order_release;
55 static ETL_CONSTANT etl::memory_order memory_order_acq_rel = std::memory_order_acq_rel;
56 static ETL_CONSTANT etl::memory_order memory_order_seq_cst = std::memory_order_seq_cst;
57
58 using atomic_bool = std::atomic<bool>;
59 using atomic_char = std::atomic<char>;
60 using atomic_schar = std::atomic<signed char>;
61 using atomic_uchar = std::atomic<unsigned char>;
62 using atomic_short = std::atomic<short>;
63 using atomic_ushort = std::atomic<unsigned short>;
64 using atomic_int = std::atomic<int>;
65 using atomic_uint = std::atomic<unsigned int>;
66 using atomic_long = std::atomic<long>;
67 using atomic_ulong = std::atomic<unsigned long>;
68 using atomic_llong = std::atomic<long long>;
69 using atomic_ullong = std::atomic<unsigned long long>;
70 using atomic_wchar_t = std::atomic<wchar_t>;
71#if ETL_HAS_NATIVE_CHAR8_T
72 using atomic_char8_t = std::atomic<char8_t>;
73#endif
74#if ETL_HAS_NATIVE_CHAR16_T
75 using atomic_char16_t = std::atomic<char16_t>;
76#endif
77#if ETL_HAS_NATIVE_CHAR32_T
78 using atomic_char32_t = std::atomic<char32_t>;
79#endif
80#if ETL_USING_8BIT_TYPES
81 using atomic_uint8_t = std::atomic<uint8_t>;
82 using atomic_int8_t = std::atomic<int8_t>;
83#endif
84 using atomic_uint16_t = std::atomic<uint16_t>;
85 using atomic_int16_t = std::atomic<int16_t>;
86 using atomic_uint32_t = std::atomic<uint32_t>;
87 using atomic_int32_t = std::atomic<int32_t>;
88#if ETL_USING_64BIT_TYPES
89 using atomic_uint64_t = std::atomic<uint64_t>;
90 using atomic_int64_t = std::atomic<int64_t>;
91#endif
92 using atomic_int_least8_t = std::atomic<int_least8_t>;
93 using atomic_uint_least8_t = std::atomic<uint_least8_t>;
94 using atomic_int_least16_t = std::atomic<int_least16_t>;
95 using atomic_uint_least16_t = std::atomic<uint_least16_t>;
96 using atomic_int_least32_t = std::atomic<int_least32_t>;
97 using atomic_uint_least32_t = std::atomic<uint_least32_t>;
98#if ETL_USING_64BIT_TYPES
99 using atomic_int_least64_t = std::atomic<int_least64_t>;
100 using atomic_uint_least64_t = std::atomic<uint_least64_t>;
101#endif
102 using atomic_int_fast8_t = std::atomic<int_fast8_t>;
103 using atomic_uint_fast8_t = std::atomic<uint_fast8_t>;
104 using atomic_int_fast16_t = std::atomic<int_fast16_t>;
105 using atomic_uint_fast16_t = std::atomic<uint_fast16_t>;
106 using atomic_int_fast32_t = std::atomic<int_fast32_t>;
107 using atomic_uint_fast32_t = std::atomic<uint_fast32_t>;
108#if ETL_USING_64BIT_TYPES
109 using atomic_int_fast64_t = std::atomic<int_fast64_t>;
110 using atomic_uint_fast64_t = std::atomic<uint_fast64_t>;
111#endif
112 using atomic_intptr_t = std::atomic<intptr_t>;
113 using atomic_uintptr_t = std::atomic<uintptr_t>;
114 using atomic_size_t = std::atomic<size_t>;
115 using atomic_ptrdiff_t = std::atomic<ptrdiff_t>;
116 using atomic_intmax_t = std::atomic<intmax_t>;
117 using atomic_uintmax_t = std::atomic<uintmax_t>;
118}
119
120#endif
bitset_ext
Definition absolute.h:38