Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===--------------------------- atomic -----------------------------------===// |
| 3 | // |
| 4 | // The LLVM Compiler Infrastructure |
| 5 | // |
| 6 | // This file is distributed under the University of Illinois Open Source |
| 7 | // License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_ATOMIC |
| 12 | #define _LIBCPP_ATOMIC |
| 13 | |
| 14 | /* |
| 15 | atomic synopsis |
| 16 | |
| 17 | namespace std |
| 18 | { |
| 19 | |
| 20 | // order and consistency |
| 21 | |
| 22 | typedef enum memory_order |
| 23 | { |
Howard Hinnant | d1176e2 | 2010-09-28 17:13:38 +0000 | [diff] [blame] | 24 | memory_order_relaxed, |
| 25 | memory_order_consume, // load-consume |
| 26 | memory_order_acquire, // load-acquire |
| 27 | memory_order_release, // store-release |
| 28 | memory_order_acq_rel, // store-release load-acquire |
| 29 | memory_order_seq_cst // store-release load-acquire |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 30 | } memory_order; |
| 31 | |
| 32 | template <class T> T kill_dependency(T y); |
| 33 | |
| 34 | // lock-free property |
| 35 | |
| 36 | #define ATOMIC_CHAR_LOCK_FREE unspecified |
| 37 | #define ATOMIC_CHAR16_T_LOCK_FREE unspecified |
| 38 | #define ATOMIC_CHAR32_T_LOCK_FREE unspecified |
| 39 | #define ATOMIC_WCHAR_T_LOCK_FREE unspecified |
| 40 | #define ATOMIC_SHORT_LOCK_FREE unspecified |
| 41 | #define ATOMIC_INT_LOCK_FREE unspecified |
| 42 | #define ATOMIC_LONG_LOCK_FREE unspecified |
| 43 | #define ATOMIC_LLONG_LOCK_FREE unspecified |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 44 | |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 45 | // flag type and operations |
| 46 | |
| 47 | typedef struct atomic_flag |
| 48 | { |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 49 | bool test_and_set(memory_order m = memory_order_seq_cst) volatile; |
| 50 | bool test_and_set(memory_order m = memory_order_seq_cst); |
| 51 | void clear(memory_order m = memory_order_seq_cst) volatile; |
| 52 | void clear(memory_order m = memory_order_seq_cst); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 53 | atomic_flag() = default; |
| 54 | atomic_flag(const atomic_flag&) = delete; |
| 55 | atomic_flag& operator=(const atomic_flag&) = delete; |
| 56 | atomic_flag& operator=(const atomic_flag&) volatile = delete; |
| 57 | } atomic_flag; |
| 58 | |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 59 | bool |
| 60 | atomic_flag_test_and_set(volatile atomic_flag* obj); |
| 61 | |
| 62 | bool |
| 63 | atomic_flag_test_and_set(atomic_flag* obj); |
| 64 | |
| 65 | bool |
| 66 | atomic_flag_test_and_set_explicit(volatile atomic_flag* obj, |
| 67 | memory_order m); |
| 68 | |
| 69 | bool |
| 70 | atomic_flag_test_and_set_explicit(atomic_flag* obj, memory_order m); |
| 71 | |
| 72 | void |
| 73 | atomic_flag_clear(volatile atomic_flag* obj); |
| 74 | |
| 75 | void |
| 76 | atomic_flag_clear(atomic_flag* obj); |
| 77 | |
| 78 | void |
| 79 | atomic_flag_clear_explicit(volatile atomic_flag* obj, memory_order m); |
| 80 | |
| 81 | void |
| 82 | atomic_flag_clear_explicit(atomic_flag* obj, memory_order m); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 83 | |
| 84 | #define ATOMIC_FLAG_INIT see below |
Howard Hinnant | e738501 | 2010-10-19 16:51:18 +0000 | [diff] [blame] | 85 | #define ATOMIC_VAR_INIT(value) see below |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 86 | |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 87 | template <class T> |
| 88 | struct atomic |
| 89 | { |
| 90 | bool is_lock_free() const volatile; |
| 91 | bool is_lock_free() const; |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 92 | void store(T desr, memory_order m = memory_order_seq_cst) volatile; |
| 93 | void store(T desr, memory_order m = memory_order_seq_cst); |
| 94 | T load(memory_order m = memory_order_seq_cst) const volatile; |
| 95 | T load(memory_order m = memory_order_seq_cst) const; |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 96 | operator T() const volatile; |
| 97 | operator T() const; |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 98 | T exchange(T desr, memory_order m = memory_order_seq_cst) volatile; |
| 99 | T exchange(T desr, memory_order m = memory_order_seq_cst); |
| 100 | bool compare_exchange_weak(T& expc, T desr, |
| 101 | memory_order s, memory_order f) volatile; |
| 102 | bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f); |
| 103 | bool compare_exchange_strong(T& expc, T desr, |
| 104 | memory_order s, memory_order f) volatile; |
| 105 | bool compare_exchange_strong(T& expc, T desr, |
| 106 | memory_order s, memory_order f); |
| 107 | bool compare_exchange_weak(T& expc, T desr, |
| 108 | memory_order m = memory_order_seq_cst) volatile; |
| 109 | bool compare_exchange_weak(T& expc, T desr, |
| 110 | memory_order m = memory_order_seq_cst); |
| 111 | bool compare_exchange_strong(T& expc, T desr, |
| 112 | memory_order m = memory_order_seq_cst) volatile; |
| 113 | bool compare_exchange_strong(T& expc, T desr, |
| 114 | memory_order m = memory_order_seq_cst); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 115 | |
| 116 | atomic() = default; |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 117 | constexpr atomic(T desr); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 118 | atomic(const atomic&) = delete; |
| 119 | atomic& operator=(const atomic&) = delete; |
| 120 | atomic& operator=(const atomic&) volatile = delete; |
| 121 | T operator=(T) volatile; |
| 122 | T operator=(T); |
| 123 | }; |
| 124 | |
| 125 | template <> |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 126 | struct atomic<integral> |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 127 | { |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 128 | bool is_lock_free() const volatile; |
| 129 | bool is_lock_free() const; |
| 130 | void store(integral desr, memory_order m = memory_order_seq_cst) volatile; |
| 131 | void store(integral desr, memory_order m = memory_order_seq_cst); |
| 132 | integral load(memory_order m = memory_order_seq_cst) const volatile; |
| 133 | integral load(memory_order m = memory_order_seq_cst) const; |
| 134 | operator integral() const volatile; |
| 135 | operator integral() const; |
| 136 | integral exchange(integral desr, |
| 137 | memory_order m = memory_order_seq_cst) volatile; |
| 138 | integral exchange(integral desr, memory_order m = memory_order_seq_cst); |
| 139 | bool compare_exchange_weak(integral& expc, integral desr, |
| 140 | memory_order s, memory_order f) volatile; |
| 141 | bool compare_exchange_weak(integral& expc, integral desr, |
| 142 | memory_order s, memory_order f); |
| 143 | bool compare_exchange_strong(integral& expc, integral desr, |
| 144 | memory_order s, memory_order f) volatile; |
| 145 | bool compare_exchange_strong(integral& expc, integral desr, |
| 146 | memory_order s, memory_order f); |
| 147 | bool compare_exchange_weak(integral& expc, integral desr, |
| 148 | memory_order m = memory_order_seq_cst) volatile; |
| 149 | bool compare_exchange_weak(integral& expc, integral desr, |
| 150 | memory_order m = memory_order_seq_cst); |
| 151 | bool compare_exchange_strong(integral& expc, integral desr, |
| 152 | memory_order m = memory_order_seq_cst) volatile; |
| 153 | bool compare_exchange_strong(integral& expc, integral desr, |
| 154 | memory_order m = memory_order_seq_cst); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 155 | |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 156 | integral |
| 157 | fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile; |
| 158 | integral fetch_add(integral op, memory_order m = memory_order_seq_cst); |
| 159 | integral |
| 160 | fetch_sub(integral op, memory_order m = memory_order_seq_cst) volatile; |
| 161 | integral fetch_sub(integral op, memory_order m = memory_order_seq_cst); |
| 162 | integral |
| 163 | fetch_and(integral op, memory_order m = memory_order_seq_cst) volatile; |
| 164 | integral fetch_and(integral op, memory_order m = memory_order_seq_cst); |
| 165 | integral |
| 166 | fetch_or(integral op, memory_order m = memory_order_seq_cst) volatile; |
| 167 | integral fetch_or(integral op, memory_order m = memory_order_seq_cst); |
| 168 | integral |
| 169 | fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile; |
| 170 | integral fetch_xor(integral op, memory_order m = memory_order_seq_cst); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 171 | |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 172 | atomic() = default; |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 173 | constexpr atomic(integral desr); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 174 | atomic(const atomic&) = delete; |
| 175 | atomic& operator=(const atomic&) = delete; |
| 176 | atomic& operator=(const atomic&) volatile = delete; |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 177 | integral operator=(integral desr) volatile; |
| 178 | integral operator=(integral desr); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 179 | |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 180 | integral operator++(int) volatile; |
| 181 | integral operator++(int); |
| 182 | integral operator--(int) volatile; |
| 183 | integral operator--(int); |
| 184 | integral operator++() volatile; |
| 185 | integral operator++(); |
| 186 | integral operator--() volatile; |
| 187 | integral operator--(); |
| 188 | integral operator+=(integral op) volatile; |
| 189 | integral operator+=(integral op); |
| 190 | integral operator-=(integral op) volatile; |
| 191 | integral operator-=(integral op); |
| 192 | integral operator&=(integral op) volatile; |
| 193 | integral operator&=(integral op); |
| 194 | integral operator|=(integral op) volatile; |
| 195 | integral operator|=(integral op); |
| 196 | integral operatorˆ=(integral op) volatile; |
| 197 | integral operatorˆ=(integral op); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 198 | }; |
| 199 | |
| 200 | template <class T> |
| 201 | struct atomic<T*> |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 202 | { |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 203 | bool is_lock_free() const volatile; |
| 204 | bool is_lock_free() const; |
| 205 | void store(T* desr, memory_order m = memory_order_seq_cst) volatile; |
| 206 | void store(T* desr, memory_order m = memory_order_seq_cst); |
| 207 | T* load(memory_order m = memory_order_seq_cst) const volatile; |
| 208 | T* load(memory_order m = memory_order_seq_cst) const; |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 209 | operator T*() const volatile; |
| 210 | operator T*() const; |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 211 | T* exchange(T* desr, memory_order m = memory_order_seq_cst) volatile; |
| 212 | T* exchange(T* desr, memory_order m = memory_order_seq_cst); |
| 213 | bool compare_exchange_weak(T*& expc, T* desr, |
| 214 | memory_order s, memory_order f) volatile; |
| 215 | bool compare_exchange_weak(T*& expc, T* desr, |
| 216 | memory_order s, memory_order f); |
| 217 | bool compare_exchange_strong(T*& expc, T* desr, |
| 218 | memory_order s, memory_order f) volatile; |
| 219 | bool compare_exchange_strong(T*& expc, T* desr, |
| 220 | memory_order s, memory_order f); |
| 221 | bool compare_exchange_weak(T*& expc, T* desr, |
| 222 | memory_order m = memory_order_seq_cst) volatile; |
| 223 | bool compare_exchange_weak(T*& expc, T* desr, |
| 224 | memory_order m = memory_order_seq_cst); |
| 225 | bool compare_exchange_strong(T*& expc, T* desr, |
| 226 | memory_order m = memory_order_seq_cst) volatile; |
| 227 | bool compare_exchange_strong(T*& expc, T* desr, |
| 228 | memory_order m = memory_order_seq_cst); |
| 229 | T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile; |
| 230 | T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst); |
| 231 | T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile; |
| 232 | T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst); |
| 233 | |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 234 | atomic() = default; |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 235 | constexpr atomic(T* desr); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 236 | atomic(const atomic&) = delete; |
| 237 | atomic& operator=(const atomic&) = delete; |
| 238 | atomic& operator=(const atomic&) volatile = delete; |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 239 | |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 240 | T* operator=(T*) volatile; |
| 241 | T* operator=(T*); |
| 242 | T* operator++(int) volatile; |
| 243 | T* operator++(int); |
| 244 | T* operator--(int) volatile; |
| 245 | T* operator--(int); |
| 246 | T* operator++() volatile; |
| 247 | T* operator++(); |
| 248 | T* operator--() volatile; |
| 249 | T* operator--(); |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 250 | T* operator+=(ptrdiff_t op) volatile; |
| 251 | T* operator+=(ptrdiff_t op); |
| 252 | T* operator-=(ptrdiff_t op) volatile; |
| 253 | T* operator-=(ptrdiff_t op); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 254 | }; |
| 255 | |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 256 | |
| 257 | template <class T> |
| 258 | bool |
| 259 | atomic_is_lock_free(const volatile atomic<T>* obj); |
| 260 | |
| 261 | template <class T> |
| 262 | bool |
| 263 | atomic_is_lock_free(const atomic<T>* obj); |
| 264 | |
| 265 | template <class T> |
| 266 | void |
| 267 | atomic_init(volatile atomic<T>* obj, T desr); |
| 268 | |
| 269 | template <class T> |
| 270 | void |
| 271 | atomic_init(atomic<T>* obj, T desr); |
| 272 | |
| 273 | template <class T> |
| 274 | void |
| 275 | atomic_store(volatile atomic<T>* obj, T desr); |
| 276 | |
| 277 | template <class T> |
| 278 | void |
| 279 | atomic_store(atomic<T>* obj, T desr); |
| 280 | |
| 281 | template <class T> |
| 282 | void |
| 283 | atomic_store_explicit(volatile atomic<T>* obj, T desr, memory_order m); |
| 284 | |
| 285 | template <class T> |
| 286 | void |
| 287 | atomic_store_explicit(atomic<T>* obj, T desr, memory_order m); |
| 288 | |
| 289 | template <class T> |
| 290 | T |
| 291 | atomic_load(const volatile atomic<T>* obj); |
| 292 | |
| 293 | template <class T> |
| 294 | T |
| 295 | atomic_load(const atomic<T>* obj); |
| 296 | |
| 297 | template <class T> |
| 298 | T |
| 299 | atomic_load_explicit(const volatile atomic<T>* obj, memory_order m); |
| 300 | |
| 301 | template <class T> |
| 302 | T |
| 303 | atomic_load_explicit(const atomic<T>* obj, memory_order m); |
| 304 | |
| 305 | template <class T> |
| 306 | T |
| 307 | atomic_exchange(volatile atomic<T>* obj, T desr); |
| 308 | |
| 309 | template <class T> |
| 310 | T |
| 311 | atomic_exchange(atomic<T>* obj, T desr); |
| 312 | |
| 313 | template <class T> |
| 314 | T |
| 315 | atomic_exchange_explicit(volatile atomic<T>* obj, T desr, memory_order m); |
| 316 | |
| 317 | template <class T> |
| 318 | T |
| 319 | atomic_exchange_explicit(atomic<T>* obj, T desr, memory_order m); |
| 320 | |
| 321 | template <class T> |
| 322 | bool |
| 323 | atomic_compare_exchange_weak(volatile atomic<T>* obj, T* expc, T desr); |
| 324 | |
| 325 | template <class T> |
| 326 | bool |
| 327 | atomic_compare_exchange_weak(atomic<T>* obj, T* expc, T desr); |
| 328 | |
| 329 | template <class T> |
| 330 | bool |
| 331 | atomic_compare_exchange_strong(volatile atomic<T>* obj, T* expc, T desr); |
| 332 | |
| 333 | template <class T> |
| 334 | bool |
| 335 | atomic_compare_exchange_strong(atomic<T>* obj, T* expc, T desr); |
| 336 | |
| 337 | template <class T> |
| 338 | bool |
| 339 | atomic_compare_exchange_weak_explicit(volatile atomic<T>* obj, T* expc, |
| 340 | T desr, |
| 341 | memory_order s, memory_order f); |
| 342 | |
| 343 | template <class T> |
| 344 | bool |
| 345 | atomic_compare_exchange_weak_explicit(atomic<T>* obj, T* expc, T desr, |
| 346 | memory_order s, memory_order f); |
| 347 | |
| 348 | template <class T> |
| 349 | bool |
| 350 | atomic_compare_exchange_strong_explicit(volatile atomic<T>* obj, |
| 351 | T* expc, T desr, |
| 352 | memory_order s, memory_order f); |
| 353 | |
| 354 | template <class T> |
| 355 | bool |
| 356 | atomic_compare_exchange_strong_explicit(atomic<T>* obj, T* expc, |
| 357 | T desr, |
| 358 | memory_order s, memory_order f); |
| 359 | |
| 360 | template <class Integral> |
| 361 | Integral |
| 362 | atomic_fetch_add(volatile atomic<Integral>* obj, Integral op); |
| 363 | |
| 364 | template <class Integral> |
| 365 | Integral |
| 366 | atomic_fetch_add(atomic<Integral>* obj, Integral op); |
| 367 | |
| 368 | template <class Integral> |
| 369 | Integral |
| 370 | atomic_fetch_add_explicit(volatile atomic<Integral>* obj, Integral op, |
| 371 | memory_order m); |
| 372 | template <class Integral> |
| 373 | Integral |
| 374 | atomic_fetch_add_explicit(atomic<Integral>* obj, Integral op, |
| 375 | memory_order m); |
| 376 | template <class Integral> |
| 377 | Integral |
| 378 | atomic_fetch_sub(volatile atomic<Integral>* obj, Integral op); |
| 379 | |
| 380 | template <class Integral> |
| 381 | Integral |
| 382 | atomic_fetch_sub(atomic<Integral>* obj, Integral op); |
| 383 | |
| 384 | template <class Integral> |
| 385 | Integral |
| 386 | atomic_fetch_sub_explicit(volatile atomic<Integral>* obj, Integral op, |
| 387 | memory_order m); |
| 388 | template <class Integral> |
| 389 | Integral |
| 390 | atomic_fetch_sub_explicit(atomic<Integral>* obj, Integral op, |
| 391 | memory_order m); |
| 392 | template <class Integral> |
| 393 | Integral |
| 394 | atomic_fetch_and(volatile atomic<Integral>* obj, Integral op); |
| 395 | |
| 396 | template <class Integral> |
| 397 | Integral |
| 398 | atomic_fetch_and(atomic<Integral>* obj, Integral op); |
| 399 | |
| 400 | template <class Integral> |
| 401 | Integral |
| 402 | atomic_fetch_and_explicit(volatile atomic<Integral>* obj, Integral op, |
| 403 | memory_order m); |
| 404 | template <class Integral> |
| 405 | Integral |
| 406 | atomic_fetch_and_explicit(atomic<Integral>* obj, Integral op, |
| 407 | memory_order m); |
| 408 | template <class Integral> |
| 409 | Integral |
| 410 | atomic_fetch_or(volatile atomic<Integral>* obj, Integral op); |
| 411 | |
| 412 | template <class Integral> |
| 413 | Integral |
| 414 | atomic_fetch_or(atomic<Integral>* obj, Integral op); |
| 415 | |
| 416 | template <class Integral> |
| 417 | Integral |
| 418 | atomic_fetch_or_explicit(volatile atomic<Integral>* obj, Integral op, |
| 419 | memory_order m); |
| 420 | template <class Integral> |
| 421 | Integral |
| 422 | atomic_fetch_or_explicit(atomic<Integral>* obj, Integral op, |
| 423 | memory_order m); |
| 424 | template <class Integral> |
| 425 | Integral |
| 426 | atomic_fetch_xor(volatile atomic<Integral>* obj, Integral op); |
| 427 | |
| 428 | template <class Integral> |
| 429 | Integral |
| 430 | atomic_fetch_xor(atomic<Integral>* obj, Integral op); |
| 431 | |
| 432 | template <class Integral> |
| 433 | Integral |
| 434 | atomic_fetch_xor_explicit(volatile atomic<Integral>* obj, Integral op, |
| 435 | memory_order m); |
| 436 | template <class Integral> |
| 437 | Integral |
| 438 | atomic_fetch_xor_explicit(atomic<Integral>* obj, Integral op, |
| 439 | memory_order m); |
| 440 | |
| 441 | template <class T> |
| 442 | T* |
| 443 | atomic_fetch_add(volatile atomic<T*>* obj, ptrdiff_t op); |
| 444 | |
| 445 | template <class T> |
| 446 | T* |
| 447 | atomic_fetch_add(atomic<T*>* obj, ptrdiff_t op); |
| 448 | |
| 449 | template <class T> |
| 450 | T* |
| 451 | atomic_fetch_add_explicit(volatile atomic<T*>* obj, ptrdiff_t op, |
| 452 | memory_order m); |
| 453 | template <class T> |
| 454 | T* |
| 455 | atomic_fetch_add_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m); |
| 456 | |
| 457 | template <class T> |
| 458 | T* |
| 459 | atomic_fetch_sub(volatile atomic<T*>* obj, ptrdiff_t op); |
| 460 | |
| 461 | template <class T> |
| 462 | T* |
| 463 | atomic_fetch_sub(atomic<T*>* obj, ptrdiff_t op); |
| 464 | |
| 465 | template <class T> |
| 466 | T* |
| 467 | atomic_fetch_sub_explicit(volatile atomic<T*>* obj, ptrdiff_t op, |
| 468 | memory_order m); |
| 469 | template <class T> |
| 470 | T* |
| 471 | atomic_fetch_sub_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m); |
| 472 | |
| 473 | // Atomics for standard typedef types |
| 474 | |
| 475 | typedef atomic<char> atomic_char; |
| 476 | typedef atomic<signed char> atomic_schar; |
| 477 | typedef atomic<unsigned char> atomic_uchar; |
| 478 | typedef atomic<short> atomic_short; |
| 479 | typedef atomic<unsigned short> atomic_ushort; |
| 480 | typedef atomic<int> atomic_int; |
| 481 | typedef atomic<unsigned int> atomic_uint; |
| 482 | typedef atomic<long> atomic_long; |
| 483 | typedef atomic<unsigned long> atomic_ulong; |
| 484 | typedef atomic<long long> atomic_llong; |
| 485 | typedef atomic<unsigned long long> atomic_ullong; |
| 486 | typedef atomic<char16_t> atomic_char16_t; |
| 487 | typedef atomic<char32_t> atomic_char32_t; |
| 488 | typedef atomic<wchar_t> atomic_wchar_t; |
| 489 | |
| 490 | typedef atomic<int_least8_t> atomic_int_least8_t; |
| 491 | typedef atomic<uint_least8_t> atomic_uint_least8_t; |
| 492 | typedef atomic<int_least16_t> atomic_int_least16_t; |
| 493 | typedef atomic<uint_least16_t> atomic_uint_least16_t; |
| 494 | typedef atomic<int_least32_t> atomic_int_least32_t; |
| 495 | typedef atomic<uint_least32_t> atomic_uint_least32_t; |
| 496 | typedef atomic<int_least64_t> atomic_int_least64_t; |
| 497 | typedef atomic<uint_least64_t> atomic_uint_least64_t; |
| 498 | |
| 499 | typedef atomic<int_fast8_t> atomic_int_fast8_t; |
| 500 | typedef atomic<uint_fast8_t> atomic_uint_fast8_t; |
| 501 | typedef atomic<int_fast16_t> atomic_int_fast16_t; |
| 502 | typedef atomic<uint_fast16_t> atomic_uint_fast16_t; |
| 503 | typedef atomic<int_fast32_t> atomic_int_fast32_t; |
| 504 | typedef atomic<uint_fast32_t> atomic_uint_fast32_t; |
| 505 | typedef atomic<int_fast64_t> atomic_int_fast64_t; |
| 506 | typedef atomic<uint_fast64_t> atomic_uint_fast64_t; |
| 507 | |
| 508 | typedef atomic<intptr_t> atomic_intptr_t; |
| 509 | typedef atomic<uintptr_t> atomic_uintptr_t; |
| 510 | typedef atomic<size_t> atomic_size_t; |
| 511 | typedef atomic<ptrdiff_t> atomic_ptrdiff_t; |
| 512 | typedef atomic<intmax_t> atomic_intmax_t; |
| 513 | typedef atomic<uintmax_t> atomic_uintmax_t; |
| 514 | |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 515 | // fences |
| 516 | |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 517 | void atomic_thread_fence(memory_order m); |
| 518 | void atomic_signal_fence(memory_order m); |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 519 | |
| 520 | } // std |
| 521 | |
| 522 | */ |
| 523 | |
| 524 | #include <__config> |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 525 | #include <cstddef> |
| 526 | #include <cstdint> |
| 527 | #include <type_traits> |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 528 | |
| 529 | #pragma GCC system_header |
| 530 | |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 531 | //// Begin Temporary Intrinsics //// |
| 532 | |
| 533 | template <class _Tp> |
| 534 | inline _LIBCPP_INLINE_VISIBILITY |
| 535 | bool |
| 536 | __atomic_is_lock_free(_Tp) |
| 537 | { |
| 538 | return false; |
| 539 | } |
| 540 | |
| 541 | template <class _Tp> |
| 542 | inline _LIBCPP_INLINE_VISIBILITY |
| 543 | _Tp |
| 544 | __atomic_load(const volatile _Tp* __t, int) |
| 545 | { |
| 546 | return *__t; |
| 547 | } |
| 548 | |
| 549 | template <class _Tp> |
| 550 | inline _LIBCPP_INLINE_VISIBILITY |
| 551 | void |
| 552 | __atomic_store(volatile _Tp* __t, _Tp __d, int) |
| 553 | { |
| 554 | *__t = __d; |
| 555 | } |
| 556 | |
| 557 | template <class _Tp> |
| 558 | inline _LIBCPP_INLINE_VISIBILITY |
| 559 | _Tp |
| 560 | __atomic_exchange(volatile _Tp* __t, _Tp __d, int) |
| 561 | { |
| 562 | _Tp __tmp = *__t; |
| 563 | *__t = __d; |
| 564 | return __tmp; |
| 565 | } |
| 566 | |
| 567 | template <class _Tp> |
| 568 | inline _LIBCPP_INLINE_VISIBILITY |
| 569 | bool |
| 570 | __atomic_compare_exchange_strong(volatile _Tp* __o, _Tp* __e, _Tp __d, int, int) |
| 571 | { |
| 572 | if (const_cast<_Tp&>(*__o) == *__e) |
| 573 | { |
| 574 | *__o = __d; |
| 575 | return true; |
| 576 | } |
| 577 | *__e = __d; |
| 578 | return false; |
| 579 | } |
| 580 | |
| 581 | template <class _Tp> |
| 582 | inline _LIBCPP_INLINE_VISIBILITY |
| 583 | bool |
| 584 | __atomic_compare_exchange_weak(volatile _Tp* __o, _Tp* __e, _Tp __d, int, int) |
| 585 | { |
| 586 | if (const_cast<_Tp&>(*__o) == *__e) |
| 587 | { |
| 588 | *__o = __d; |
| 589 | return true; |
| 590 | } |
| 591 | *__e = __d; |
| 592 | return false; |
| 593 | } |
| 594 | |
| 595 | //// End Temporary Intrinsics //// |
| 596 | |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 597 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 598 | |
Howard Hinnant | d1176e2 | 2010-09-28 17:13:38 +0000 | [diff] [blame] | 599 | typedef enum memory_order |
| 600 | { |
| 601 | memory_order_relaxed, memory_order_consume, memory_order_acquire, |
| 602 | memory_order_release, memory_order_acq_rel, memory_order_seq_cst |
| 603 | } memory_order; |
| 604 | |
| 605 | template <class _Tp> |
| 606 | inline _LIBCPP_INLINE_VISIBILITY |
| 607 | _Tp |
| 608 | kill_dependency(_Tp __y) |
| 609 | { |
| 610 | return __y; |
| 611 | } |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 612 | |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 613 | template <class T> struct atomic; |
| 614 | |
| 615 | // atomic_is_lock_free |
| 616 | |
| 617 | template <class _Tp> |
| 618 | inline _LIBCPP_INLINE_VISIBILITY |
| 619 | bool |
| 620 | atomic_is_lock_free(const volatile atomic<_Tp>*) |
| 621 | { |
| 622 | return __atomic_is_lock_free(_Tp()); |
| 623 | } |
| 624 | |
| 625 | template <class _Tp> |
| 626 | inline _LIBCPP_INLINE_VISIBILITY |
| 627 | bool |
| 628 | atomic_is_lock_free(const atomic<_Tp>*) |
| 629 | { |
| 630 | return __atomic_is_lock_free(_Tp()); |
| 631 | } |
| 632 | |
| 633 | // atomic_init |
| 634 | |
| 635 | template <class _Tp> |
| 636 | inline _LIBCPP_INLINE_VISIBILITY |
| 637 | void |
| 638 | atomic_init(volatile atomic<_Tp>* __o, _Tp __d) |
| 639 | { |
| 640 | __o->__a_ = __d; |
| 641 | } |
| 642 | |
| 643 | template <class _Tp> |
| 644 | inline _LIBCPP_INLINE_VISIBILITY |
| 645 | void |
| 646 | atomic_init(atomic<_Tp>* __o, _Tp __d) |
| 647 | { |
| 648 | __o->__a_ = __d; |
| 649 | } |
| 650 | |
| 651 | // atomic_store |
| 652 | |
| 653 | template <class _Tp> |
| 654 | inline _LIBCPP_INLINE_VISIBILITY |
| 655 | void |
| 656 | atomic_store(volatile atomic<_Tp>* __o, _Tp __d) |
| 657 | { |
| 658 | __atomic_store(&__o->__a_, __d, memory_order_seq_cst); |
| 659 | } |
| 660 | |
| 661 | template <class _Tp> |
| 662 | inline _LIBCPP_INLINE_VISIBILITY |
| 663 | void |
| 664 | atomic_store(atomic<_Tp>* __o, _Tp __d) |
| 665 | { |
| 666 | __atomic_store(&__o->__a_, __d, memory_order_seq_cst); |
| 667 | } |
| 668 | |
| 669 | // atomic_store_explicit |
| 670 | |
| 671 | template <class _Tp> |
| 672 | inline _LIBCPP_INLINE_VISIBILITY |
| 673 | void |
| 674 | atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) |
| 675 | { |
| 676 | __atomic_store(&__o->__a_, __d, __m); |
| 677 | } |
| 678 | |
| 679 | template <class _Tp> |
| 680 | inline _LIBCPP_INLINE_VISIBILITY |
| 681 | void |
| 682 | atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) |
| 683 | { |
| 684 | __atomic_store(&__o->__a_, __d, __m); |
| 685 | } |
| 686 | |
| 687 | // atomic_load |
| 688 | |
| 689 | template <class _Tp> |
| 690 | inline _LIBCPP_INLINE_VISIBILITY |
| 691 | _Tp |
| 692 | atomic_load(const volatile atomic<_Tp>* __o) |
| 693 | { |
| 694 | return __atomic_load(&__o->__a_, memory_order_seq_cst); |
| 695 | } |
| 696 | |
| 697 | template <class _Tp> |
| 698 | inline _LIBCPP_INLINE_VISIBILITY |
| 699 | _Tp |
| 700 | atomic_load(const atomic<_Tp>* __o) |
| 701 | { |
| 702 | return __atomic_load(&__o->__a_, memory_order_seq_cst); |
| 703 | } |
| 704 | |
| 705 | // atomic_load_explicit |
| 706 | |
| 707 | template <class _Tp> |
| 708 | inline _LIBCPP_INLINE_VISIBILITY |
| 709 | _Tp |
| 710 | atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) |
| 711 | { |
| 712 | return __atomic_load(&__o->__a_, __m); |
| 713 | } |
| 714 | |
| 715 | template <class _Tp> |
| 716 | inline _LIBCPP_INLINE_VISIBILITY |
| 717 | _Tp |
| 718 | atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) |
| 719 | { |
| 720 | return __atomic_load(&__o->__a_, __m); |
| 721 | } |
| 722 | |
| 723 | // atomic_exchange |
| 724 | |
| 725 | template <class _Tp> |
| 726 | inline _LIBCPP_INLINE_VISIBILITY |
| 727 | _Tp |
| 728 | atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) |
| 729 | { |
| 730 | return __atomic_exchange(&__o->__a_, __d, memory_order_seq_cst); |
| 731 | } |
| 732 | |
| 733 | template <class _Tp> |
| 734 | inline _LIBCPP_INLINE_VISIBILITY |
| 735 | _Tp |
| 736 | atomic_exchange(atomic<_Tp>* __o, _Tp __d) |
| 737 | { |
| 738 | return __atomic_exchange(&__o->__a_, __d, memory_order_seq_cst); |
| 739 | } |
| 740 | |
| 741 | // atomic_exchange_explicit |
| 742 | |
| 743 | template <class _Tp> |
| 744 | inline _LIBCPP_INLINE_VISIBILITY |
| 745 | _Tp |
| 746 | atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) |
| 747 | { |
| 748 | return __atomic_exchange(&__o->__a_, __d, __m); |
| 749 | } |
| 750 | |
| 751 | template <class _Tp> |
| 752 | inline _LIBCPP_INLINE_VISIBILITY |
| 753 | _Tp |
| 754 | atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) |
| 755 | { |
| 756 | return __atomic_exchange(&__o->__a_, __d, __m); |
| 757 | } |
| 758 | |
| 759 | // atomic_compare_exchange_weak |
| 760 | |
| 761 | template <class _Tp> |
| 762 | inline _LIBCPP_INLINE_VISIBILITY |
| 763 | bool |
| 764 | atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) |
| 765 | { |
| 766 | return __atomic_compare_exchange_weak(&__o->__a_, __e, __d, |
| 767 | memory_order_seq_cst, |
| 768 | memory_order_seq_cst); |
| 769 | } |
| 770 | |
| 771 | template <class _Tp> |
| 772 | inline _LIBCPP_INLINE_VISIBILITY |
| 773 | bool |
| 774 | atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) |
| 775 | { |
| 776 | return __atomic_compare_exchange_weak(&__o->__a_, __e, __d, |
| 777 | memory_order_seq_cst, |
| 778 | memory_order_seq_cst); |
| 779 | } |
| 780 | |
| 781 | // atomic_compare_exchange_strong |
| 782 | |
| 783 | template <class _Tp> |
| 784 | inline _LIBCPP_INLINE_VISIBILITY |
| 785 | bool |
| 786 | atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) |
| 787 | { |
| 788 | return __atomic_compare_exchange_strong(&__o->__a_, __e, __d, |
| 789 | memory_order_seq_cst, |
| 790 | memory_order_seq_cst); |
| 791 | } |
| 792 | |
| 793 | template <class _Tp> |
| 794 | inline _LIBCPP_INLINE_VISIBILITY |
| 795 | bool |
| 796 | atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) |
| 797 | { |
| 798 | return __atomic_compare_exchange_strong(&__o->__a_, __e, __d, |
| 799 | memory_order_seq_cst, |
| 800 | memory_order_seq_cst); |
| 801 | } |
| 802 | |
| 803 | // atomic_compare_exchange_weak_explicit |
| 804 | |
| 805 | template <class _Tp> |
| 806 | inline _LIBCPP_INLINE_VISIBILITY |
| 807 | bool |
| 808 | atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e, |
| 809 | _Tp __d, |
| 810 | memory_order __s, memory_order __f) |
| 811 | { |
| 812 | return __atomic_compare_exchange_weak(&__o->__a_, __e, __d, __s, __f); |
| 813 | } |
| 814 | |
| 815 | template <class _Tp> |
| 816 | inline _LIBCPP_INLINE_VISIBILITY |
| 817 | bool |
| 818 | atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d, |
| 819 | memory_order __s, memory_order __f) |
| 820 | { |
| 821 | return __atomic_compare_exchange_weak(&__o->__a_, __e, __d, __s, __f); |
| 822 | } |
| 823 | |
| 824 | // atomic_compare_exchange_strong_explicit |
| 825 | |
| 826 | template <class _Tp> |
| 827 | inline _LIBCPP_INLINE_VISIBILITY |
| 828 | bool |
| 829 | atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o, |
| 830 | _Tp* __e, _Tp __d, |
| 831 | memory_order __s, memory_order __f) |
| 832 | { |
| 833 | return __atomic_compare_exchange_strong(&__o->__a_, __e, __d, __s, __f); |
| 834 | } |
| 835 | |
| 836 | template <class _Tp> |
| 837 | inline _LIBCPP_INLINE_VISIBILITY |
| 838 | bool |
| 839 | atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e, |
| 840 | _Tp __d, |
| 841 | memory_order __s, memory_order __f) |
| 842 | { |
| 843 | return __atomic_compare_exchange_strong(&__o->__a_, __e, __d, __s, __f); |
| 844 | } |
| 845 | |
| 846 | |
| 847 | // atomic<T> |
| 848 | |
| 849 | template <class _Tp> |
| 850 | struct atomic |
| 851 | { |
| 852 | _Tp __a_; |
| 853 | |
| 854 | bool is_lock_free() const volatile; |
| 855 | bool is_lock_free() const; |
| 856 | void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile; |
| 857 | void store(_Tp __d, memory_order __m = memory_order_seq_cst); |
| 858 | _LIBCPP_INLINE_VISIBILITY |
| 859 | _Tp load(memory_order __m = memory_order_seq_cst) const volatile |
| 860 | {return atomic_load_explicit(this, __m);} |
| 861 | _LIBCPP_INLINE_VISIBILITY |
| 862 | _Tp load(memory_order __m = memory_order_seq_cst) const |
| 863 | {return atomic_load_explicit(this, __m);} |
| 864 | _LIBCPP_INLINE_VISIBILITY |
| 865 | operator _Tp() const volatile {return load();} |
| 866 | _LIBCPP_INLINE_VISIBILITY |
| 867 | operator _Tp() const {return load();} |
| 868 | _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile; |
| 869 | _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst); |
| 870 | bool compare_exchange_weak(_Tp& __e, _Tp __d, |
| 871 | memory_order __s, memory_order __f) volatile; |
| 872 | bool compare_exchange_weak(_Tp& __e, _Tp __d, |
| 873 | memory_order __s, memory_order __f); |
| 874 | bool compare_exchange_strong(_Tp& __e, _Tp __d, |
| 875 | memory_order __s, memory_order __f) volatile; |
| 876 | bool compare_exchange_strong(_Tp& __e, _Tp __d, |
| 877 | memory_order __s, memory_order __f); |
| 878 | bool compare_exchange_weak(_Tp& __e, _Tp __d, |
| 879 | memory_order __m = memory_order_seq_cst) volatile; |
| 880 | bool compare_exchange_weak(_Tp& __e, _Tp __d, |
| 881 | memory_order __m = memory_order_seq_cst); |
| 882 | bool compare_exchange_strong(_Tp& __e, _Tp __d, |
| 883 | memory_order __m = memory_order_seq_cst) volatile; |
| 884 | bool compare_exchange_strong(_Tp& __e, _Tp __d, |
| 885 | memory_order __m = memory_order_seq_cst); |
| 886 | |
| 887 | atomic() {} // = default; |
| 888 | constexpr atomic(_Tp __d); |
| 889 | atomic(const atomic&) = delete; |
| 890 | atomic& operator=(const atomic&) = delete; |
| 891 | atomic& operator=(const atomic&) volatile = delete; |
| 892 | _Tp operator=(_Tp) volatile; |
| 893 | _Tp operator=(_Tp); |
| 894 | }; |
| 895 | |
| 896 | /* |
Howard Hinnant | ed760f4 | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 897 | // flag type and operations |
| 898 | |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 899 | typedef bool __atomic_flag__; |
Howard Hinnant | 6cac2c2 | 2010-10-05 14:02:23 +0000 | [diff] [blame] | 900 | |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 901 | struct atomic_flag; |
Howard Hinnant | ed760f4 | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 902 | |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 903 | bool atomic_flag_test_and_set(volatile atomic_flag*); |
| 904 | bool atomic_flag_test_and_set(atomic_flag*); |
| 905 | bool atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order); |
| 906 | bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order); |
| 907 | void atomic_flag_clear(volatile atomic_flag*); |
| 908 | void atomic_flag_clear(atomic_flag*); |
| 909 | void atomic_flag_clear_explicit(volatile atomic_flag*, memory_order); |
| 910 | void atomic_flag_clear_explicit(atomic_flag*, memory_order); |
| 911 | |
| 912 | typedef struct _LIBCPP_VISIBLE atomic_flag |
Howard Hinnant | ed760f4 | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 913 | { |
Howard Hinnant | 6cac2c2 | 2010-10-05 14:02:23 +0000 | [diff] [blame] | 914 | __atomic_flag__ __flg_; |
Howard Hinnant | ed760f4 | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 915 | |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 916 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 917 | bool test_and_set(memory_order __o = memory_order_seq_cst) volatile |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 918 | {return atomic_flag_test_and_set_explicit(this, __o);} |
| 919 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 920 | bool test_and_set(memory_order __o = memory_order_seq_cst) |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 921 | {return atomic_flag_test_and_set_explicit(this, __o);} |
Howard Hinnant | ed760f4 | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 922 | |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 923 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 924 | void clear(memory_order __o = memory_order_seq_cst) volatile |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 925 | {atomic_flag_clear_explicit(this, __o);} |
| 926 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 927 | void clear(memory_order __o = memory_order_seq_cst) |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 928 | {atomic_flag_clear_explicit(this, __o);} |
Howard Hinnant | ed760f4 | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 929 | |
| 930 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 931 | atomic_flag() = default; |
| 932 | #else |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 933 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 79101ae | 2010-09-30 21:05:29 +0000 | [diff] [blame] | 934 | atomic_flag() {}; |
Howard Hinnant | ed760f4 | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 935 | #endif |
| 936 | |
Howard Hinnant | ed760f4 | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 937 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 938 | atomic_flag(const atomic_flag&) = delete; |
| 939 | atomic_flag& operator=(const atomic_flag&) = delete; |
| 940 | atomic_flag& operator=(const atomic_flag&) volatile = delete; |
| 941 | #else |
| 942 | private: |
| 943 | atomic_flag(const atomic_flag&); |
| 944 | atomic_flag& operator=(const atomic_flag&); |
| 945 | atomic_flag& operator=(const atomic_flag&) volatile; |
| 946 | public: |
| 947 | #endif |
Howard Hinnant | ed760f4 | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 948 | } atomic_flag; |
| 949 | |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 950 | inline _LIBCPP_INLINE_VISIBILITY |
| 951 | bool |
| 952 | atomic_flag_test_and_set(volatile atomic_flag* __f) |
| 953 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 954 | return __atomic_exchange(&__f->__flg_, __atomic_flag__(true), |
| 955 | memory_order_seq_cst) |
Howard Hinnant | 6cac2c2 | 2010-10-05 14:02:23 +0000 | [diff] [blame] | 956 | == __atomic_flag__(true); |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 957 | } |
Howard Hinnant | ed760f4 | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 958 | |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 959 | inline _LIBCPP_INLINE_VISIBILITY |
| 960 | bool |
| 961 | atomic_flag_test_and_set(atomic_flag* __f) |
| 962 | { |
| 963 | return atomic_flag_test_and_set(const_cast<volatile atomic_flag*>(__f)); |
| 964 | } |
| 965 | |
| 966 | inline _LIBCPP_INLINE_VISIBILITY |
| 967 | bool |
| 968 | atomic_flag_test_and_set_explicit(volatile atomic_flag* __f, memory_order __o) |
| 969 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 970 | return __atomic_exchange(&__f->__flg_, __atomic_flag__(true), __o) |
Howard Hinnant | 6cac2c2 | 2010-10-05 14:02:23 +0000 | [diff] [blame] | 971 | == __atomic_flag__(true); |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 972 | } |
| 973 | |
| 974 | inline _LIBCPP_INLINE_VISIBILITY |
| 975 | bool |
| 976 | atomic_flag_test_and_set_explicit(atomic_flag* __f, memory_order __o) |
| 977 | { |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 978 | return atomic_flag_test_and_set_explicit(const_cast<volatile atomic_flag*> |
| 979 | (__f), __o); |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 980 | } |
| 981 | |
| 982 | inline _LIBCPP_INLINE_VISIBILITY |
| 983 | void |
| 984 | atomic_flag_clear(volatile atomic_flag* __f) |
| 985 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 986 | __atomic_store(&__f->__flg_, __atomic_flag__(false), memory_order_seq_cst); |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 987 | } |
| 988 | |
| 989 | inline _LIBCPP_INLINE_VISIBILITY |
| 990 | void |
| 991 | atomic_flag_clear(atomic_flag* __f) |
| 992 | { |
| 993 | atomic_flag_clear(const_cast<volatile atomic_flag*>(__f)); |
| 994 | } |
| 995 | |
| 996 | inline _LIBCPP_INLINE_VISIBILITY |
| 997 | void |
| 998 | atomic_flag_clear_explicit(volatile atomic_flag* __f, memory_order __o) |
| 999 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1000 | __atomic_store(&__f->__flg_, __atomic_flag__(false), __o); |
Howard Hinnant | 767ae2b | 2010-09-29 21:20:03 +0000 | [diff] [blame] | 1001 | } |
| 1002 | |
| 1003 | inline _LIBCPP_INLINE_VISIBILITY |
| 1004 | void |
| 1005 | atomic_flag_clear_explicit(atomic_flag* __f, memory_order __o) |
| 1006 | { |
| 1007 | atomic_flag_clear_explicit(const_cast<volatile atomic_flag*>(__f), __o); |
| 1008 | } |
| 1009 | |
| 1010 | #define ATOMIC_FLAG_INIT {false} |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1011 | #define ATOMIC_VAR_INIT(__v) {__v} |
| 1012 | |
| 1013 | inline _LIBCPP_INLINE_VISIBILITY |
| 1014 | memory_order |
| 1015 | __translate_memory_order(memory_order __o) |
| 1016 | { |
| 1017 | switch (__o) |
| 1018 | { |
| 1019 | case memory_order_acq_rel: |
| 1020 | return memory_order_acquire; |
| 1021 | case memory_order_release: |
| 1022 | return memory_order_relaxed; |
| 1023 | } |
| 1024 | return __o; |
| 1025 | } |
| 1026 | |
| 1027 | // atomic_bool |
| 1028 | |
| 1029 | struct atomic_bool; |
| 1030 | |
| 1031 | bool atomic_is_lock_free(const volatile atomic_bool*); |
| 1032 | bool atomic_is_lock_free(const atomic_bool*); |
| 1033 | void atomic_init(volatile atomic_bool*, bool); |
| 1034 | void atomic_init(atomic_bool*, bool); |
| 1035 | void atomic_store(volatile atomic_bool*, bool); |
| 1036 | void atomic_store(atomic_bool*, bool); |
| 1037 | void atomic_store_explicit(volatile atomic_bool*, bool, memory_order); |
| 1038 | void atomic_store_explicit(atomic_bool*, bool, memory_order); |
| 1039 | bool atomic_load(const volatile atomic_bool*); |
| 1040 | bool atomic_load(const atomic_bool*); |
| 1041 | bool atomic_load_explicit(const volatile atomic_bool*, memory_order); |
| 1042 | bool atomic_load_explicit(const atomic_bool*, memory_order); |
| 1043 | bool atomic_exchange(volatile atomic_bool*, bool); |
| 1044 | bool atomic_exchange(atomic_bool*, bool); |
| 1045 | bool atomic_exchange_explicit(volatile atomic_bool*, bool, memory_order); |
| 1046 | bool atomic_exchange_explicit(atomic_bool*, bool, memory_order); |
| 1047 | bool atomic_compare_exchange_weak(volatile atomic_bool*, bool*, bool); |
| 1048 | bool atomic_compare_exchange_weak(atomic_bool*, bool*, bool); |
| 1049 | bool atomic_compare_exchange_strong(volatile atomic_bool*, bool*, bool); |
| 1050 | bool atomic_compare_exchange_strong(atomic_bool*, bool*, bool); |
| 1051 | bool atomic_compare_exchange_weak_explicit(volatile atomic_bool*, bool*, bool, |
| 1052 | memory_order, memory_order); |
| 1053 | bool atomic_compare_exchange_weak_explicit(atomic_bool*, bool*, bool, |
| 1054 | memory_order, memory_order); |
| 1055 | bool atomic_compare_exchange_strong_explicit(volatile atomic_bool*, bool*, bool, |
| 1056 | memory_order, memory_order); |
| 1057 | bool atomic_compare_exchange_strong_explicit(atomic_bool*, bool*, bool, |
| 1058 | memory_order, memory_order); |
| 1059 | |
| 1060 | typedef struct atomic_bool |
| 1061 | { |
| 1062 | bool __v_; |
| 1063 | |
| 1064 | _LIBCPP_INLINE_VISIBILITY |
| 1065 | bool is_lock_free() const volatile |
| 1066 | {return atomic_is_lock_free(this);} |
| 1067 | _LIBCPP_INLINE_VISIBILITY |
| 1068 | bool is_lock_free() const |
| 1069 | {return atomic_is_lock_free(this);} |
| 1070 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1071 | void store(bool __v, memory_order __o = memory_order_seq_cst) volatile |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1072 | {atomic_store_explicit(this, __v, __o);} |
| 1073 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1074 | void store(bool __v, memory_order __o = memory_order_seq_cst) |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1075 | {atomic_store_explicit(this, __v, __o);} |
| 1076 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1077 | bool load(memory_order __o = memory_order_seq_cst) const volatile |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1078 | {return atomic_load_explicit(this, __o);} |
| 1079 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1080 | bool load(memory_order __o = memory_order_seq_cst) const |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1081 | {return atomic_load_explicit(this, __o);} |
| 1082 | _LIBCPP_INLINE_VISIBILITY |
| 1083 | operator bool() const volatile |
| 1084 | {return load();} |
| 1085 | _LIBCPP_INLINE_VISIBILITY |
| 1086 | operator bool() const |
| 1087 | {return load();} |
| 1088 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1089 | bool exchange(bool __v, memory_order __o = memory_order_seq_cst) volatile |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1090 | {return atomic_exchange_explicit(this, __v, __o);} |
| 1091 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1092 | bool exchange(bool __v, memory_order __o = memory_order_seq_cst) |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1093 | {return atomic_exchange_explicit(this, __v, __o);} |
| 1094 | _LIBCPP_INLINE_VISIBILITY |
| 1095 | bool compare_exchange_weak(bool& __v, bool __e, memory_order __s, |
| 1096 | memory_order __f) volatile |
| 1097 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 1098 | __f);} |
| 1099 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1100 | bool compare_exchange_weak(bool& __v, bool __e, |
| 1101 | memory_order __s = memory_order_seq_cst) volatile |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1102 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1103 | __translate_memory_order(__s));} |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1104 | _LIBCPP_INLINE_VISIBILITY |
| 1105 | bool compare_exchange_weak(bool& __v, bool __e, memory_order __s, |
| 1106 | memory_order __f) |
| 1107 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 1108 | __f);} |
| 1109 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1110 | bool compare_exchange_weak(bool& __v, bool __e, |
| 1111 | memory_order __s = memory_order_seq_cst) |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1112 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1113 | __translate_memory_order(__s));} |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1114 | _LIBCPP_INLINE_VISIBILITY |
| 1115 | bool compare_exchange_strong(bool& __v, bool __e, memory_order __s, |
| 1116 | memory_order __f) volatile |
| 1117 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 1118 | __f);} |
| 1119 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1120 | bool compare_exchange_strong(bool& __v, bool __e, |
| 1121 | memory_order __s = memory_order_seq_cst) volatile |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1122 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1123 | __translate_memory_order(__s));} |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1124 | _LIBCPP_INLINE_VISIBILITY |
| 1125 | bool compare_exchange_strong(bool& __v, bool __e, memory_order __s, |
| 1126 | memory_order __f) |
| 1127 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 1128 | __f);} |
| 1129 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1130 | bool compare_exchange_strong(bool& __v, bool __e, |
| 1131 | memory_order __s = memory_order_seq_cst) |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1132 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1133 | __translate_memory_order(__s));} |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1134 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 1135 | atomic_bool() = default; |
| 1136 | #else |
| 1137 | _LIBCPP_INLINE_VISIBILITY |
| 1138 | atomic_bool() {} |
| 1139 | #endif |
| 1140 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 1141 | constexpr atomic_bool(bool __v) |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1142 | : __v_(__v) {} |
| 1143 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 1144 | atomic_bool(const atomic_bool&) = delete; |
| 1145 | atomic_bool& operator=(const atomic_bool&) = delete; |
| 1146 | atomic_bool& operator=(const atomic_bool&) volatile = delete; |
| 1147 | #else |
| 1148 | private: |
| 1149 | atomic_bool(const atomic_bool&); |
| 1150 | atomic_bool& operator=(const atomic_bool&); |
| 1151 | atomic_bool& operator=(const atomic_bool&) volatile; |
| 1152 | public: |
| 1153 | #endif |
| 1154 | _LIBCPP_INLINE_VISIBILITY |
| 1155 | bool operator=(bool __v) volatile |
| 1156 | {store(__v); return __v;} |
Howard Hinnant | e738501 | 2010-10-19 16:51:18 +0000 | [diff] [blame] | 1157 | _LIBCPP_INLINE_VISIBILITY |
| 1158 | bool operator=(bool __v) |
| 1159 | {store(__v); return __v;} |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1160 | } atomic_bool; |
| 1161 | |
| 1162 | inline _LIBCPP_INLINE_VISIBILITY |
| 1163 | bool atomic_is_lock_free(const volatile atomic_bool*) |
| 1164 | { |
Howard Hinnant | e738501 | 2010-10-19 16:51:18 +0000 | [diff] [blame] | 1165 | typedef bool type; |
| 1166 | return __atomic_is_lock_free(type); |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1167 | } |
| 1168 | |
| 1169 | inline _LIBCPP_INLINE_VISIBILITY |
| 1170 | bool atomic_is_lock_free(const atomic_bool* __obj) |
| 1171 | { |
| 1172 | return atomic_is_lock_free(const_cast<const volatile atomic_bool*>(__obj)); |
| 1173 | } |
| 1174 | |
| 1175 | inline _LIBCPP_INLINE_VISIBILITY |
| 1176 | void atomic_init(volatile atomic_bool* __obj, bool __desr) |
| 1177 | { |
| 1178 | __obj->__v_ = __desr; |
| 1179 | } |
| 1180 | |
| 1181 | inline _LIBCPP_INLINE_VISIBILITY |
| 1182 | void atomic_init(atomic_bool* __obj, bool __desr) |
| 1183 | { |
| 1184 | __obj->__v_ = __desr; |
| 1185 | } |
| 1186 | |
| 1187 | inline _LIBCPP_INLINE_VISIBILITY |
| 1188 | void atomic_store(volatile atomic_bool* __obj, bool __desr) |
| 1189 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1190 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1191 | } |
| 1192 | |
| 1193 | inline _LIBCPP_INLINE_VISIBILITY |
| 1194 | void atomic_store(atomic_bool* __obj, bool __desr) |
| 1195 | { |
| 1196 | atomic_store(const_cast<volatile atomic_bool*>(__obj), __desr); |
| 1197 | } |
| 1198 | |
| 1199 | inline _LIBCPP_INLINE_VISIBILITY |
| 1200 | void atomic_store_explicit(volatile atomic_bool* __obj, bool __desr, |
| 1201 | memory_order __o) |
| 1202 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1203 | __atomic_store(&__obj->__v_, __desr, __o); |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1204 | } |
| 1205 | |
| 1206 | inline _LIBCPP_INLINE_VISIBILITY |
| 1207 | void atomic_store_explicit(atomic_bool* __obj, bool __desr, memory_order __o) |
| 1208 | { |
| 1209 | atomic_store_explicit(const_cast<volatile atomic_bool*>(__obj), __desr, |
| 1210 | __o); |
| 1211 | } |
| 1212 | |
| 1213 | inline _LIBCPP_INLINE_VISIBILITY |
| 1214 | bool atomic_load(const volatile atomic_bool* __obj) |
| 1215 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1216 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1217 | } |
| 1218 | |
| 1219 | inline _LIBCPP_INLINE_VISIBILITY |
| 1220 | bool atomic_load(const atomic_bool* __obj) |
| 1221 | { |
| 1222 | return atomic_load(const_cast<const volatile atomic_bool*>(__obj)); |
| 1223 | } |
| 1224 | |
| 1225 | inline _LIBCPP_INLINE_VISIBILITY |
| 1226 | bool atomic_load_explicit(const volatile atomic_bool* __obj, memory_order __o) |
| 1227 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1228 | return __atomic_load(&__obj->__v_, __o); |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1229 | } |
| 1230 | |
| 1231 | inline _LIBCPP_INLINE_VISIBILITY |
| 1232 | bool atomic_load_explicit(const atomic_bool* __obj, memory_order __o) |
| 1233 | { |
| 1234 | return atomic_load_explicit(const_cast<const volatile atomic_bool*> |
| 1235 | (__obj), __o); |
| 1236 | } |
| 1237 | |
| 1238 | inline _LIBCPP_INLINE_VISIBILITY |
| 1239 | bool atomic_exchange(volatile atomic_bool* __obj, bool __desr) |
| 1240 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1241 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1242 | } |
| 1243 | |
| 1244 | inline _LIBCPP_INLINE_VISIBILITY |
| 1245 | bool atomic_exchange(atomic_bool* __obj, bool __desr) |
| 1246 | { |
| 1247 | return atomic_exchange(const_cast<volatile atomic_bool*>(__obj), __desr); |
| 1248 | } |
| 1249 | |
| 1250 | inline _LIBCPP_INLINE_VISIBILITY |
| 1251 | bool atomic_exchange_explicit(volatile atomic_bool* __obj, bool __desr, |
| 1252 | memory_order __o) |
| 1253 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1254 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1255 | } |
| 1256 | |
| 1257 | inline _LIBCPP_INLINE_VISIBILITY |
| 1258 | bool atomic_exchange_explicit(atomic_bool* __obj, bool __desr, memory_order __o) |
| 1259 | { |
| 1260 | return atomic_exchange_explicit(const_cast<volatile atomic_bool*> |
| 1261 | (__obj), __desr, __o); |
| 1262 | } |
| 1263 | |
| 1264 | inline _LIBCPP_INLINE_VISIBILITY |
| 1265 | bool atomic_compare_exchange_weak(volatile atomic_bool* __obj, bool* __exp, |
| 1266 | bool __desr) |
| 1267 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1268 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 1269 | memory_order_seq_cst, memory_order_seq_cst); |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1270 | } |
| 1271 | |
| 1272 | inline _LIBCPP_INLINE_VISIBILITY |
| 1273 | bool atomic_compare_exchange_weak(atomic_bool* __obj, bool* __exp, bool __desr) |
| 1274 | { |
| 1275 | return atomic_compare_exchange_weak(const_cast<volatile atomic_bool*> |
| 1276 | (__obj), __exp, __desr); |
| 1277 | } |
| 1278 | |
| 1279 | inline _LIBCPP_INLINE_VISIBILITY |
| 1280 | bool atomic_compare_exchange_weak_explicit(volatile atomic_bool* __obj, |
| 1281 | bool* __exp, bool __desr, |
| 1282 | memory_order __s, memory_order __f) |
| 1283 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1284 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 1285 | __f); |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1286 | } |
| 1287 | |
| 1288 | inline _LIBCPP_INLINE_VISIBILITY |
| 1289 | bool atomic_compare_exchange_weak_explicit(atomic_bool* __obj, bool* __exp, |
| 1290 | bool __desr, |
| 1291 | memory_order __s, memory_order __f) |
| 1292 | { |
| 1293 | return atomic_compare_exchange_weak_explicit( |
| 1294 | const_cast<volatile atomic_bool*>(__obj), __exp, __desr, __s, __f); |
| 1295 | } |
| 1296 | |
| 1297 | inline _LIBCPP_INLINE_VISIBILITY |
| 1298 | bool atomic_compare_exchange_strong(volatile atomic_bool* __obj, bool* __exp, |
| 1299 | bool __desr) |
| 1300 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1301 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 1302 | memory_order_seq_cst, memory_order_seq_cst); |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1303 | } |
| 1304 | |
| 1305 | inline _LIBCPP_INLINE_VISIBILITY |
| 1306 | bool atomic_compare_exchange_strong(atomic_bool* __obj, bool* __exp, |
| 1307 | bool __desr) |
| 1308 | { |
| 1309 | return atomic_compare_exchange_strong(const_cast<volatile atomic_bool*> |
| 1310 | (__obj), __exp, __desr); |
| 1311 | } |
| 1312 | |
| 1313 | inline _LIBCPP_INLINE_VISIBILITY |
| 1314 | bool atomic_compare_exchange_strong_explicit(volatile atomic_bool* __obj, |
| 1315 | bool* __exp, bool __desr, |
| 1316 | memory_order __s, memory_order __f) |
| 1317 | { |
Howard Hinnant | 21ef47f | 2010-10-18 20:39:07 +0000 | [diff] [blame] | 1318 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 1319 | __f); |
Howard Hinnant | 611fdaf | 2010-10-04 18:52:54 +0000 | [diff] [blame] | 1320 | } |
| 1321 | |
| 1322 | inline _LIBCPP_INLINE_VISIBILITY |
| 1323 | bool atomic_compare_exchange_strong_explicit(atomic_bool* __obj, bool* __exp, |
| 1324 | bool __desr, |
| 1325 | memory_order __s, memory_order __f) |
| 1326 | { |
| 1327 | return atomic_compare_exchange_strong_explicit( |
| 1328 | const_cast<volatile atomic_bool*>(__obj), __exp, __desr, __s, __f); |
| 1329 | } |
Howard Hinnant | ed760f4 | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 1330 | |
Howard Hinnant | e738501 | 2010-10-19 16:51:18 +0000 | [diff] [blame] | 1331 | // atomic_char |
| 1332 | |
| 1333 | struct atomic_char; |
| 1334 | |
| 1335 | bool atomic_is_lock_free(const volatile atomic_char*); |
| 1336 | bool atomic_is_lock_free(const atomic_char*); |
| 1337 | void atomic_init(volatile atomic_char*, char); |
| 1338 | void atomic_init(atomic_char*, char); |
| 1339 | void atomic_store(volatile atomic_char*, char); |
| 1340 | void atomic_store(atomic_char*, char); |
| 1341 | void atomic_store_explicit(volatile atomic_char*, char, memory_order); |
| 1342 | void atomic_store_explicit(atomic_char*, char, memory_order); |
| 1343 | char atomic_load(const volatile atomic_char*); |
| 1344 | char atomic_load(const atomic_char*); |
| 1345 | char atomic_load_explicit(const volatile atomic_char*, memory_order); |
| 1346 | char atomic_load_explicit(const atomic_char*, memory_order); |
| 1347 | char atomic_exchange(volatile atomic_char*, char); |
| 1348 | char atomic_exchange(atomic_char*, char); |
| 1349 | char atomic_exchange_explicit(volatile atomic_char*, char, memory_order); |
| 1350 | char atomic_exchange_explicit(atomic_char*, char, memory_order); |
| 1351 | bool atomic_compare_exchange_weak(volatile atomic_char*, char*, char); |
| 1352 | bool atomic_compare_exchange_weak(atomic_char*, char*, char); |
| 1353 | bool atomic_compare_exchange_strong(volatile atomic_char*, char*, char); |
| 1354 | bool atomic_compare_exchange_strong(atomic_char*, char*, char); |
| 1355 | bool atomic_compare_exchange_weak_explicit(volatile atomic_char*, char*, char, |
| 1356 | memory_order, memory_order); |
| 1357 | bool atomic_compare_exchange_weak_explicit(atomic_char*, char*, char, |
| 1358 | memory_order, memory_order); |
| 1359 | bool atomic_compare_exchange_strong_explicit(volatile atomic_char*, char*, char, |
| 1360 | memory_order, memory_order); |
| 1361 | bool atomic_compare_exchange_strong_explicit(atomic_char*, char*, char, |
| 1362 | memory_order, memory_order); |
| 1363 | char atomic_fetch_add(volatile atomic_char*, char); |
| 1364 | char atomic_fetch_add(atomic_char*, char); |
| 1365 | char atomic_fetch_add_explicit(volatile atomic_char*, char, memory_order); |
| 1366 | char atomic_fetch_add_explicit(atomic_char*, char, memory_order); |
| 1367 | char atomic_fetch_sub(volatile atomic_char*, char); |
| 1368 | char atomic_fetch_sub(atomic_char*, char); |
| 1369 | char atomic_fetch_sub_explicit(volatile atomic_char*, char, memory_order); |
| 1370 | char atomic_fetch_sub_explicit(atomic_char*, char, memory_order); |
| 1371 | char atomic_fetch_and(volatile atomic_char*, char); |
| 1372 | char atomic_fetch_and(atomic_char*, char); |
| 1373 | char atomic_fetch_and_explicit(volatile atomic_char*, char, memory_order); |
| 1374 | char atomic_fetch_and_explicit(atomic_char*, char, memory_order); |
| 1375 | char atomic_fetch_or(volatile atomic_char*, char); |
| 1376 | char atomic_fetch_or(atomic_char*, char); |
| 1377 | char atomic_fetch_or_explicit(volatile atomic_char*, char, memory_order); |
| 1378 | char atomic_fetch_or_explicit(atomic_char*, char, memory_order); |
| 1379 | char atomic_fetch_xor(volatile atomic_char*, char); |
| 1380 | char atomic_fetch_xor(atomic_char*, char); |
| 1381 | char atomic_fetch_xor_explicit(volatile atomic_char*, char, memory_order); |
| 1382 | char atomic_fetch_xor_explicit(atomic_char*, char, memory_order); |
| 1383 | |
| 1384 | typedef struct atomic_char |
| 1385 | { |
| 1386 | char __v_; |
| 1387 | |
| 1388 | _LIBCPP_INLINE_VISIBILITY |
| 1389 | bool is_lock_free() const volatile |
| 1390 | {return atomic_is_lock_free(this);} |
| 1391 | _LIBCPP_INLINE_VISIBILITY |
| 1392 | bool is_lock_free() const |
| 1393 | {return atomic_is_lock_free(this);} |
| 1394 | _LIBCPP_INLINE_VISIBILITY |
| 1395 | void store(char __v, memory_order __o = memory_order_seq_cst) volatile |
| 1396 | {atomic_store_explicit(this, __v, __o);} |
| 1397 | _LIBCPP_INLINE_VISIBILITY |
| 1398 | void store(char __v, memory_order __o = memory_order_seq_cst) |
| 1399 | {atomic_store_explicit(this, __v, __o);} |
| 1400 | _LIBCPP_INLINE_VISIBILITY |
| 1401 | char load(memory_order __o = memory_order_seq_cst) const volatile |
| 1402 | {return atomic_load_explicit(this, __o);} |
| 1403 | _LIBCPP_INLINE_VISIBILITY |
| 1404 | char load(memory_order __o = memory_order_seq_cst) const |
| 1405 | {return atomic_load_explicit(this, __o);} |
| 1406 | _LIBCPP_INLINE_VISIBILITY |
| 1407 | operator char() const volatile |
| 1408 | {return load();} |
| 1409 | _LIBCPP_INLINE_VISIBILITY |
| 1410 | operator char() const |
| 1411 | {return load();} |
| 1412 | _LIBCPP_INLINE_VISIBILITY |
| 1413 | char exchange(char __v, memory_order __o = memory_order_seq_cst) volatile |
| 1414 | {return atomic_exchange_explicit(this, __v, __o);} |
| 1415 | _LIBCPP_INLINE_VISIBILITY |
| 1416 | char exchange(char __v, memory_order __o = memory_order_seq_cst) |
| 1417 | {return atomic_exchange_explicit(this, __v, __o);} |
| 1418 | _LIBCPP_INLINE_VISIBILITY |
| 1419 | bool compare_exchange_weak(char& __v, char __e, memory_order __s, |
| 1420 | memory_order __f) volatile |
| 1421 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 1422 | __f);} |
| 1423 | _LIBCPP_INLINE_VISIBILITY |
| 1424 | bool compare_exchange_weak(char& __v, char __e, memory_order __s, |
| 1425 | memory_order __f) |
| 1426 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 1427 | __f);} |
| 1428 | _LIBCPP_INLINE_VISIBILITY |
| 1429 | bool compare_exchange_strong(char& __v, char __e, memory_order __s, |
| 1430 | memory_order __f) volatile |
| 1431 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 1432 | __f);} |
| 1433 | _LIBCPP_INLINE_VISIBILITY |
| 1434 | bool compare_exchange_strong(char& __v, char __e, memory_order __s, |
| 1435 | memory_order __f) |
| 1436 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 1437 | __f);} |
| 1438 | _LIBCPP_INLINE_VISIBILITY |
| 1439 | bool compare_exchange_weak(char& __v, char __e, |
| 1440 | memory_order __s = memory_order_seq_cst) volatile |
| 1441 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 1442 | __translate_memory_order(__s));} |
| 1443 | _LIBCPP_INLINE_VISIBILITY |
| 1444 | bool compare_exchange_weak(char& __v, char __e, |
| 1445 | memory_order __s = memory_order_seq_cst) |
| 1446 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 1447 | __translate_memory_order(__s));} |
| 1448 | _LIBCPP_INLINE_VISIBILITY |
| 1449 | bool compare_exchange_strong(char& __v, char __e, |
| 1450 | memory_order __s = memory_order_seq_cst) volatile |
| 1451 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 1452 | __translate_memory_order(__s));} |
| 1453 | _LIBCPP_INLINE_VISIBILITY |
| 1454 | bool compare_exchange_strong(char& __v, char __e, |
| 1455 | memory_order __s = memory_order_seq_cst) |
| 1456 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 1457 | __translate_memory_order(__s));} |
| 1458 | _LIBCPP_INLINE_VISIBILITY |
| 1459 | char fetch_add(char __v, memory_order __o = memory_order_seq_cst) volatile |
| 1460 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 1461 | _LIBCPP_INLINE_VISIBILITY |
| 1462 | char fetch_add(char __v, memory_order __o = memory_order_seq_cst) |
| 1463 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 1464 | _LIBCPP_INLINE_VISIBILITY |
| 1465 | char fetch_sub(char __v, memory_order __o = memory_order_seq_cst) volatile |
| 1466 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 1467 | _LIBCPP_INLINE_VISIBILITY |
| 1468 | char fetch_sub(char __v, memory_order __o = memory_order_seq_cst) |
| 1469 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 1470 | _LIBCPP_INLINE_VISIBILITY |
| 1471 | char fetch_and(char __v, memory_order __o = memory_order_seq_cst) volatile |
| 1472 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 1473 | _LIBCPP_INLINE_VISIBILITY |
| 1474 | char fetch_and(char __v, memory_order __o = memory_order_seq_cst) |
| 1475 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 1476 | _LIBCPP_INLINE_VISIBILITY |
| 1477 | char fetch_or(char __v, memory_order __o = memory_order_seq_cst) volatile |
| 1478 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 1479 | _LIBCPP_INLINE_VISIBILITY |
| 1480 | char fetch_or(char __v, memory_order __o = memory_order_seq_cst) |
| 1481 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 1482 | _LIBCPP_INLINE_VISIBILITY |
| 1483 | char fetch_xor(char __v, memory_order __o = memory_order_seq_cst) volatile |
| 1484 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 1485 | _LIBCPP_INLINE_VISIBILITY |
| 1486 | char fetch_xor(char __v, memory_order __o = memory_order_seq_cst) |
| 1487 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 1488 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 1489 | atomic_char() = default; |
| 1490 | #else |
| 1491 | _LIBCPP_INLINE_VISIBILITY |
| 1492 | atomic_char() {} |
| 1493 | #endif |
| 1494 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 1495 | constexpr atomic_char(char __v) |
Howard Hinnant | e738501 | 2010-10-19 16:51:18 +0000 | [diff] [blame] | 1496 | : __v_(__v) {} |
| 1497 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 1498 | atomic_char(const atomic_char&) = delete; |
| 1499 | atomic_char& operator=(const atomic_char&) = delete; |
| 1500 | atomic_char& operator=(const atomic_char&) volatile = delete; |
| 1501 | #else |
| 1502 | private: |
| 1503 | atomic_char(const atomic_char&); |
| 1504 | atomic_char& operator=(const atomic_char&); |
| 1505 | atomic_char& operator=(const atomic_char&) volatile; |
| 1506 | public: |
| 1507 | #endif |
| 1508 | _LIBCPP_INLINE_VISIBILITY |
| 1509 | char operator=(char __v) volatile |
| 1510 | {store(__v); return __v;} |
| 1511 | _LIBCPP_INLINE_VISIBILITY |
| 1512 | char operator=(char __v) |
| 1513 | {store(__v); return __v;} |
| 1514 | _LIBCPP_INLINE_VISIBILITY |
| 1515 | char operator++(int) volatile |
| 1516 | {return fetch_add(char(1));} |
| 1517 | _LIBCPP_INLINE_VISIBILITY |
| 1518 | char operator++(int) |
| 1519 | {return fetch_add(char(1));} |
| 1520 | _LIBCPP_INLINE_VISIBILITY |
| 1521 | char operator--(int) volatile |
| 1522 | {return fetch_sub(char(1));} |
| 1523 | _LIBCPP_INLINE_VISIBILITY |
| 1524 | char operator--(int) |
| 1525 | {return fetch_sub(char(1));} |
| 1526 | _LIBCPP_INLINE_VISIBILITY |
| 1527 | char operator++() volatile |
| 1528 | {return char(fetch_add(char(1)) + 1);} |
| 1529 | _LIBCPP_INLINE_VISIBILITY |
| 1530 | char operator++() |
| 1531 | {return char(fetch_add(char(1)) + 1);} |
| 1532 | _LIBCPP_INLINE_VISIBILITY |
| 1533 | char operator--() volatile |
| 1534 | {return char(fetch_sub(char(1)) - 1);} |
| 1535 | _LIBCPP_INLINE_VISIBILITY |
| 1536 | char operator--() |
| 1537 | {return char(fetch_sub(char(1)) - 1);} |
| 1538 | _LIBCPP_INLINE_VISIBILITY |
| 1539 | char operator+=(char __v) volatile |
| 1540 | {return char(fetch_add(__v) + __v);} |
| 1541 | _LIBCPP_INLINE_VISIBILITY |
| 1542 | char operator+=(char __v) |
| 1543 | {return char(fetch_add(__v) + __v);} |
| 1544 | _LIBCPP_INLINE_VISIBILITY |
| 1545 | char operator-=(char __v) volatile |
| 1546 | {return char(fetch_sub(__v) - __v);} |
| 1547 | _LIBCPP_INLINE_VISIBILITY |
| 1548 | char operator-=(char __v) |
| 1549 | {return char(fetch_sub(__v) - __v);} |
| 1550 | _LIBCPP_INLINE_VISIBILITY |
| 1551 | char operator&=(char __v) volatile |
| 1552 | {return char(fetch_and(__v) & __v);} |
| 1553 | _LIBCPP_INLINE_VISIBILITY |
| 1554 | char operator&=(char __v) |
| 1555 | {return char(fetch_and(__v) & __v);} |
| 1556 | _LIBCPP_INLINE_VISIBILITY |
| 1557 | char operator|=(char __v) volatile |
| 1558 | {return char(fetch_or(__v) | __v);} |
| 1559 | _LIBCPP_INLINE_VISIBILITY |
| 1560 | char operator|=(char __v) |
| 1561 | {return char(fetch_or(__v) | __v);} |
| 1562 | _LIBCPP_INLINE_VISIBILITY |
| 1563 | char operator^=(char __v) volatile |
| 1564 | {return char(fetch_xor(__v) ^ __v);} |
| 1565 | _LIBCPP_INLINE_VISIBILITY |
| 1566 | char operator^=(char __v) |
| 1567 | {return char(fetch_xor(__v) ^ __v);} |
| 1568 | } atomic_char; |
| 1569 | |
| 1570 | inline _LIBCPP_INLINE_VISIBILITY |
| 1571 | bool |
| 1572 | atomic_is_lock_free(const volatile atomic_char*) |
| 1573 | { |
| 1574 | typedef char type; |
| 1575 | return __atomic_is_lock_free(type); |
| 1576 | } |
| 1577 | |
| 1578 | inline _LIBCPP_INLINE_VISIBILITY |
| 1579 | bool |
| 1580 | atomic_is_lock_free(const atomic_char* __obj) |
| 1581 | { |
| 1582 | return atomic_is_lock_free(const_cast<volatile atomic_char*>(__obj)); |
| 1583 | } |
| 1584 | |
| 1585 | inline _LIBCPP_INLINE_VISIBILITY |
| 1586 | void |
| 1587 | atomic_init(volatile atomic_char* __obj, char __desr) |
| 1588 | { |
| 1589 | __obj->__v_ = __desr; |
| 1590 | } |
| 1591 | |
| 1592 | inline _LIBCPP_INLINE_VISIBILITY |
| 1593 | void |
| 1594 | atomic_init(atomic_char* __obj, char __desr) |
| 1595 | { |
| 1596 | __obj->__v_ = __desr; |
| 1597 | } |
| 1598 | |
| 1599 | inline _LIBCPP_INLINE_VISIBILITY |
| 1600 | void |
| 1601 | atomic_store(volatile atomic_char* __obj, char __desr) |
| 1602 | { |
| 1603 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 1604 | } |
| 1605 | |
| 1606 | inline _LIBCPP_INLINE_VISIBILITY |
| 1607 | void |
| 1608 | atomic_store(atomic_char* __obj, char __desr) |
| 1609 | { |
| 1610 | atomic_store(const_cast<volatile atomic_char*>(__obj), __desr); |
| 1611 | } |
| 1612 | |
| 1613 | inline _LIBCPP_INLINE_VISIBILITY |
| 1614 | void |
| 1615 | atomic_store_explicit(volatile atomic_char* __obj, char __desr, |
| 1616 | memory_order __o) |
| 1617 | { |
| 1618 | __atomic_store(&__obj->__v_, __desr, __o); |
| 1619 | } |
| 1620 | |
| 1621 | inline _LIBCPP_INLINE_VISIBILITY |
| 1622 | void |
| 1623 | atomic_store_explicit(atomic_char* __obj, char __desr, memory_order __o) |
| 1624 | { |
| 1625 | atomic_store_explicit(const_cast<volatile atomic_char*>(__obj), __desr, |
| 1626 | __o); |
| 1627 | } |
| 1628 | |
| 1629 | inline _LIBCPP_INLINE_VISIBILITY |
| 1630 | char |
| 1631 | atomic_load(const volatile atomic_char* __obj) |
| 1632 | { |
| 1633 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 1634 | } |
| 1635 | |
| 1636 | inline _LIBCPP_INLINE_VISIBILITY |
| 1637 | char |
| 1638 | atomic_load(const atomic_char* __obj) |
| 1639 | { |
| 1640 | return atomic_load(const_cast<const volatile atomic_char*>(__obj)); |
| 1641 | } |
| 1642 | |
| 1643 | inline _LIBCPP_INLINE_VISIBILITY |
| 1644 | char |
| 1645 | atomic_load_explicit(const volatile atomic_char* __obj, memory_order __o) |
| 1646 | { |
| 1647 | return __atomic_load(&__obj->__v_, __o); |
| 1648 | } |
| 1649 | |
| 1650 | inline _LIBCPP_INLINE_VISIBILITY |
| 1651 | char |
| 1652 | atomic_load_explicit(const atomic_char* __obj, memory_order __o) |
| 1653 | { |
| 1654 | return atomic_load_explicit(const_cast<const volatile atomic_char*> |
| 1655 | (__obj), __o); |
| 1656 | } |
| 1657 | |
| 1658 | inline _LIBCPP_INLINE_VISIBILITY |
| 1659 | char |
| 1660 | atomic_exchange(volatile atomic_char* __obj, char __desr) |
| 1661 | { |
| 1662 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 1663 | } |
| 1664 | |
| 1665 | inline _LIBCPP_INLINE_VISIBILITY |
| 1666 | char |
| 1667 | atomic_exchange(atomic_char* __obj, char __desr) |
| 1668 | { |
| 1669 | return atomic_exchange(const_cast<volatile atomic_char*>(__obj), __desr); |
| 1670 | } |
| 1671 | |
| 1672 | inline _LIBCPP_INLINE_VISIBILITY |
| 1673 | char |
| 1674 | atomic_exchange_explicit(volatile atomic_char* __obj, char __desr, |
| 1675 | memory_order __o) |
| 1676 | { |
| 1677 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 1678 | } |
| 1679 | |
| 1680 | inline _LIBCPP_INLINE_VISIBILITY |
| 1681 | char |
| 1682 | atomic_exchange_explicit(atomic_char* __obj, char __desr, memory_order __o) |
| 1683 | { |
| 1684 | return atomic_exchange_explicit(const_cast<volatile atomic_char*> |
| 1685 | (__obj), __desr, __o); |
| 1686 | } |
| 1687 | |
| 1688 | inline _LIBCPP_INLINE_VISIBILITY |
| 1689 | bool |
| 1690 | atomic_compare_exchange_weak(volatile atomic_char* __obj, char* __exp, |
| 1691 | char __desr) |
| 1692 | { |
| 1693 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 1694 | memory_order_seq_cst, memory_order_seq_cst); |
| 1695 | } |
| 1696 | |
| 1697 | inline _LIBCPP_INLINE_VISIBILITY |
| 1698 | bool |
| 1699 | atomic_compare_exchange_weak(atomic_char* __obj, char* __exp, char __desr) |
| 1700 | { |
| 1701 | return atomic_compare_exchange_weak(const_cast<volatile atomic_char*> |
| 1702 | (__obj), __exp, __desr); |
| 1703 | } |
| 1704 | |
| 1705 | inline _LIBCPP_INLINE_VISIBILITY |
| 1706 | bool |
| 1707 | atomic_compare_exchange_strong(volatile atomic_char* __obj, char* __exp, |
| 1708 | char __desr) |
| 1709 | { |
| 1710 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 1711 | memory_order_seq_cst, memory_order_seq_cst); |
| 1712 | } |
| 1713 | |
| 1714 | inline _LIBCPP_INLINE_VISIBILITY |
| 1715 | bool |
| 1716 | atomic_compare_exchange_strong(atomic_char* __obj, char* __exp, char __desr) |
| 1717 | { |
| 1718 | return atomic_compare_exchange_strong(const_cast<volatile atomic_char*> |
| 1719 | (__obj), __exp, __desr); |
| 1720 | } |
| 1721 | |
| 1722 | inline _LIBCPP_INLINE_VISIBILITY |
| 1723 | bool |
| 1724 | atomic_compare_exchange_weak_explicit(volatile atomic_char* __obj, char* __exp, |
| 1725 | char __desr, memory_order __s, |
| 1726 | memory_order __f) |
| 1727 | { |
| 1728 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 1729 | __f); |
| 1730 | } |
| 1731 | |
| 1732 | inline _LIBCPP_INLINE_VISIBILITY |
| 1733 | bool |
| 1734 | atomic_compare_exchange_weak_explicit(atomic_char* __obj, char* __exp, |
| 1735 | char __desr, memory_order __s, |
| 1736 | memory_order __f) |
| 1737 | { |
| 1738 | return atomic_compare_exchange_weak_explicit( |
| 1739 | const_cast<volatile atomic_char*>(__obj), __exp, __desr, __s, __f); |
| 1740 | } |
| 1741 | |
| 1742 | inline _LIBCPP_INLINE_VISIBILITY |
| 1743 | bool |
| 1744 | atomic_compare_exchange_strong_explicit(volatile atomic_char* __obj, |
| 1745 | char* __exp, char __desr, |
| 1746 | memory_order __s, memory_order __f) |
| 1747 | { |
| 1748 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 1749 | __f); |
| 1750 | } |
| 1751 | |
| 1752 | inline _LIBCPP_INLINE_VISIBILITY |
| 1753 | bool |
| 1754 | atomic_compare_exchange_strong_explicit(atomic_char* __obj, char* __exp, |
| 1755 | char __desr, memory_order __s, |
| 1756 | memory_order __f) |
| 1757 | { |
| 1758 | return atomic_compare_exchange_strong_explicit( |
| 1759 | const_cast<volatile atomic_char*>(__obj), __exp, __desr, __s, __f); |
| 1760 | } |
| 1761 | |
| 1762 | inline _LIBCPP_INLINE_VISIBILITY |
| 1763 | char |
| 1764 | atomic_fetch_add(volatile atomic_char* __obj, char __v) |
| 1765 | { |
| 1766 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 1767 | } |
| 1768 | |
| 1769 | inline _LIBCPP_INLINE_VISIBILITY |
| 1770 | char |
| 1771 | atomic_fetch_add(atomic_char* __obj, char __v) |
| 1772 | { |
| 1773 | return atomic_fetch_add(const_cast<volatile atomic_char*>(__obj), __v); |
| 1774 | } |
| 1775 | |
| 1776 | inline _LIBCPP_INLINE_VISIBILITY |
| 1777 | char |
| 1778 | atomic_fetch_add_explicit(volatile atomic_char* __obj, char __v, |
| 1779 | memory_order __o) |
| 1780 | { |
| 1781 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 1782 | } |
| 1783 | |
| 1784 | inline _LIBCPP_INLINE_VISIBILITY |
| 1785 | char |
| 1786 | atomic_fetch_add_explicit(atomic_char* __obj, char __v, memory_order __o) |
| 1787 | { |
| 1788 | return atomic_fetch_add_explicit(const_cast<volatile atomic_char*>(__obj), |
| 1789 | __v, __o); |
| 1790 | } |
| 1791 | |
| 1792 | inline _LIBCPP_INLINE_VISIBILITY |
| 1793 | char |
| 1794 | atomic_fetch_sub(volatile atomic_char* __obj, char __v) |
| 1795 | { |
| 1796 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 1797 | } |
| 1798 | |
| 1799 | inline _LIBCPP_INLINE_VISIBILITY |
| 1800 | char |
| 1801 | atomic_fetch_sub(atomic_char* __obj, char __v) |
| 1802 | { |
| 1803 | return atomic_fetch_sub(const_cast<volatile atomic_char*>(__obj), __v); |
| 1804 | } |
| 1805 | |
| 1806 | inline _LIBCPP_INLINE_VISIBILITY |
| 1807 | char |
| 1808 | atomic_fetch_sub_explicit(volatile atomic_char* __obj, char __v, |
| 1809 | memory_order __o) |
| 1810 | { |
| 1811 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 1812 | } |
| 1813 | |
| 1814 | inline _LIBCPP_INLINE_VISIBILITY |
| 1815 | char |
| 1816 | atomic_fetch_sub_explicit(atomic_char* __obj, char __v, memory_order __o) |
| 1817 | { |
| 1818 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_char*>(__obj), |
| 1819 | __v, __o); |
| 1820 | } |
| 1821 | |
| 1822 | inline _LIBCPP_INLINE_VISIBILITY |
| 1823 | char |
| 1824 | atomic_fetch_and(volatile atomic_char* __obj, char __v) |
| 1825 | { |
| 1826 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 1827 | } |
| 1828 | |
| 1829 | inline _LIBCPP_INLINE_VISIBILITY |
| 1830 | char |
| 1831 | atomic_fetch_and(atomic_char* __obj, char __v) |
| 1832 | { |
| 1833 | return atomic_fetch_and(const_cast<volatile atomic_char*>(__obj), __v); |
| 1834 | } |
| 1835 | |
| 1836 | inline _LIBCPP_INLINE_VISIBILITY |
| 1837 | char |
| 1838 | atomic_fetch_and_explicit(volatile atomic_char* __obj, char __v, |
| 1839 | memory_order __o) |
| 1840 | { |
| 1841 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 1842 | } |
| 1843 | |
| 1844 | inline _LIBCPP_INLINE_VISIBILITY |
| 1845 | char |
| 1846 | atomic_fetch_and_explicit(atomic_char* __obj, char __v, memory_order __o) |
| 1847 | { |
| 1848 | return atomic_fetch_and_explicit(const_cast<volatile atomic_char*>(__obj), |
| 1849 | __v, __o); |
| 1850 | } |
| 1851 | |
| 1852 | inline _LIBCPP_INLINE_VISIBILITY |
| 1853 | char |
| 1854 | atomic_fetch_or(volatile atomic_char* __obj, char __v) |
| 1855 | { |
| 1856 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 1857 | } |
| 1858 | |
| 1859 | inline _LIBCPP_INLINE_VISIBILITY |
| 1860 | char |
| 1861 | atomic_fetch_or(atomic_char* __obj, char __v) |
| 1862 | { |
| 1863 | return atomic_fetch_or(const_cast<volatile atomic_char*>(__obj), __v); |
| 1864 | } |
| 1865 | |
| 1866 | inline _LIBCPP_INLINE_VISIBILITY |
| 1867 | char |
| 1868 | atomic_fetch_or_explicit(volatile atomic_char* __obj, char __v, |
| 1869 | memory_order __o) |
| 1870 | { |
| 1871 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 1872 | } |
| 1873 | |
| 1874 | inline _LIBCPP_INLINE_VISIBILITY |
| 1875 | char |
| 1876 | atomic_fetch_or_explicit(atomic_char* __obj, char __v, memory_order __o) |
| 1877 | { |
| 1878 | return atomic_fetch_or_explicit(const_cast<volatile atomic_char*>(__obj), |
| 1879 | __v, __o); |
| 1880 | } |
| 1881 | |
| 1882 | inline _LIBCPP_INLINE_VISIBILITY |
| 1883 | char |
| 1884 | atomic_fetch_xor(volatile atomic_char* __obj, char __v) |
| 1885 | { |
| 1886 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 1887 | } |
| 1888 | |
| 1889 | inline _LIBCPP_INLINE_VISIBILITY |
| 1890 | char |
| 1891 | atomic_fetch_xor(atomic_char* __obj, char __v) |
| 1892 | { |
| 1893 | return atomic_fetch_xor(const_cast<volatile atomic_char*>(__obj), __v); |
| 1894 | } |
| 1895 | |
| 1896 | inline _LIBCPP_INLINE_VISIBILITY |
| 1897 | char |
| 1898 | atomic_fetch_xor_explicit(volatile atomic_char* __obj, char __v, |
| 1899 | memory_order __o) |
| 1900 | { |
| 1901 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 1902 | } |
| 1903 | |
| 1904 | inline _LIBCPP_INLINE_VISIBILITY |
| 1905 | char |
| 1906 | atomic_fetch_xor_explicit(atomic_char* __obj, char __v, memory_order __o) |
| 1907 | { |
| 1908 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_char*>(__obj), |
| 1909 | __v, __o); |
| 1910 | } |
| 1911 | |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 1912 | // atomic_schar |
| 1913 | |
| 1914 | struct atomic_schar; |
| 1915 | |
| 1916 | bool atomic_is_lock_free(const volatile atomic_schar*); |
| 1917 | bool atomic_is_lock_free(const atomic_schar*); |
| 1918 | void atomic_init(volatile atomic_schar*, signed char); |
| 1919 | void atomic_init(atomic_schar*, signed char); |
| 1920 | void atomic_store(volatile atomic_schar*, signed char); |
| 1921 | void atomic_store(atomic_schar*, signed char); |
| 1922 | void atomic_store_explicit(volatile atomic_schar*, signed char, memory_order); |
| 1923 | void atomic_store_explicit(atomic_schar*, signed char, memory_order); |
| 1924 | signed char atomic_load(const volatile atomic_schar*); |
| 1925 | signed char atomic_load(const atomic_schar*); |
| 1926 | signed char atomic_load_explicit(const volatile atomic_schar*, memory_order); |
| 1927 | signed char atomic_load_explicit(const atomic_schar*, memory_order); |
| 1928 | signed char atomic_exchange(volatile atomic_schar*, signed char); |
| 1929 | signed char atomic_exchange(atomic_schar*, signed char); |
| 1930 | signed char atomic_exchange_explicit(volatile atomic_schar*, signed char, |
| 1931 | memory_order); |
| 1932 | signed char atomic_exchange_explicit(atomic_schar*, signed char, memory_order); |
| 1933 | bool atomic_compare_exchange_weak(volatile atomic_schar*, signed char*, |
| 1934 | signed char); |
| 1935 | bool atomic_compare_exchange_weak(atomic_schar*, signed char*, signed char); |
| 1936 | bool atomic_compare_exchange_strong(volatile atomic_schar*, signed char*, |
| 1937 | signed char); |
| 1938 | bool atomic_compare_exchange_strong(atomic_schar*, signed char*, signed char); |
| 1939 | bool atomic_compare_exchange_weak_explicit(volatile atomic_schar*, signed char*, |
| 1940 | signed char, memory_order, |
| 1941 | memory_order); |
| 1942 | bool atomic_compare_exchange_weak_explicit(atomic_schar*, signed char*, |
| 1943 | signed char, memory_order, |
| 1944 | memory_order); |
| 1945 | bool atomic_compare_exchange_strong_explicit(volatile atomic_schar*, |
| 1946 | signed char*, signed char, |
| 1947 | memory_order, memory_order); |
| 1948 | bool atomic_compare_exchange_strong_explicit(atomic_schar*, signed char*, |
| 1949 | signed char, memory_order, |
| 1950 | memory_order); |
| 1951 | signed char atomic_fetch_add(volatile atomic_schar*, signed char); |
| 1952 | signed char atomic_fetch_add(atomic_schar*, signed char); |
| 1953 | signed char atomic_fetch_add_explicit(volatile atomic_schar*, signed char, |
| 1954 | memory_order); |
| 1955 | signed char atomic_fetch_add_explicit(atomic_schar*, signed char, memory_order); |
| 1956 | signed char atomic_fetch_sub(volatile atomic_schar*, signed char); |
| 1957 | signed char atomic_fetch_sub(atomic_schar*, signed char); |
| 1958 | signed char atomic_fetch_sub_explicit(volatile atomic_schar*, signed char, |
| 1959 | memory_order); |
| 1960 | signed char atomic_fetch_sub_explicit(atomic_schar*, signed char, memory_order); |
| 1961 | signed char atomic_fetch_and(volatile atomic_schar*, signed char); |
| 1962 | signed char atomic_fetch_and(atomic_schar*, signed char); |
| 1963 | signed char atomic_fetch_and_explicit(volatile atomic_schar*, signed char, |
| 1964 | memory_order); |
| 1965 | signed char atomic_fetch_and_explicit(atomic_schar*, signed char, memory_order); |
| 1966 | signed char atomic_fetch_or(volatile atomic_schar*, signed char); |
| 1967 | signed char atomic_fetch_or(atomic_schar*, signed char); |
| 1968 | signed char atomic_fetch_or_explicit(volatile atomic_schar*, signed char, |
| 1969 | memory_order); |
| 1970 | signed char atomic_fetch_or_explicit(atomic_schar*, signed char, memory_order); |
| 1971 | signed char atomic_fetch_xor(volatile atomic_schar*, signed char); |
| 1972 | signed char atomic_fetch_xor(atomic_schar*, signed char); |
| 1973 | signed char atomic_fetch_xor_explicit(volatile atomic_schar*, signed char, |
| 1974 | memory_order); |
| 1975 | signed char atomic_fetch_xor_explicit(atomic_schar*, signed char, memory_order); |
| 1976 | |
| 1977 | typedef struct atomic_schar |
| 1978 | { |
| 1979 | signed char __v_; |
| 1980 | |
| 1981 | _LIBCPP_INLINE_VISIBILITY |
| 1982 | bool is_lock_free() const volatile |
| 1983 | {return atomic_is_lock_free(this);} |
| 1984 | _LIBCPP_INLINE_VISIBILITY |
| 1985 | bool is_lock_free() const |
| 1986 | {return atomic_is_lock_free(this);} |
| 1987 | _LIBCPP_INLINE_VISIBILITY |
| 1988 | void store(signed char __v, |
| 1989 | memory_order __o = memory_order_seq_cst) volatile |
| 1990 | {atomic_store_explicit(this, __v, __o);} |
| 1991 | _LIBCPP_INLINE_VISIBILITY |
| 1992 | void store(signed char __v, memory_order __o = memory_order_seq_cst) |
| 1993 | {atomic_store_explicit(this, __v, __o);} |
| 1994 | _LIBCPP_INLINE_VISIBILITY |
| 1995 | signed char load(memory_order __o = memory_order_seq_cst) const volatile |
| 1996 | {return atomic_load_explicit(this, __o);} |
| 1997 | _LIBCPP_INLINE_VISIBILITY |
| 1998 | signed char load(memory_order __o = memory_order_seq_cst) const |
| 1999 | {return atomic_load_explicit(this, __o);} |
| 2000 | _LIBCPP_INLINE_VISIBILITY |
| 2001 | operator signed char() const volatile |
| 2002 | {return load();} |
| 2003 | _LIBCPP_INLINE_VISIBILITY |
| 2004 | operator signed char() const |
| 2005 | {return load();} |
| 2006 | _LIBCPP_INLINE_VISIBILITY |
| 2007 | signed char exchange(signed char __v, |
| 2008 | memory_order __o = memory_order_seq_cst) volatile |
| 2009 | {return atomic_exchange_explicit(this, __v, __o);} |
| 2010 | _LIBCPP_INLINE_VISIBILITY |
| 2011 | signed char exchange(signed char __v, |
| 2012 | memory_order __o = memory_order_seq_cst) |
| 2013 | {return atomic_exchange_explicit(this, __v, __o);} |
| 2014 | _LIBCPP_INLINE_VISIBILITY |
| 2015 | bool compare_exchange_weak(signed char& __v, signed char __e, |
| 2016 | memory_order __s, memory_order __f) volatile |
| 2017 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 2018 | __f);} |
| 2019 | _LIBCPP_INLINE_VISIBILITY |
| 2020 | bool compare_exchange_weak(signed char& __v, signed char __e, |
| 2021 | memory_order __s, memory_order __f) |
| 2022 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 2023 | __f);} |
| 2024 | _LIBCPP_INLINE_VISIBILITY |
| 2025 | bool compare_exchange_strong(signed char& __v, signed char __e, |
| 2026 | memory_order __s, memory_order __f) volatile |
| 2027 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 2028 | __f);} |
| 2029 | _LIBCPP_INLINE_VISIBILITY |
| 2030 | bool compare_exchange_strong(signed char& __v, signed char __e, |
| 2031 | memory_order __s, memory_order __f) |
| 2032 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 2033 | __f);} |
| 2034 | _LIBCPP_INLINE_VISIBILITY |
| 2035 | bool compare_exchange_weak(signed char& __v, signed char __e, |
| 2036 | memory_order __s = memory_order_seq_cst) volatile |
| 2037 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 2038 | __translate_memory_order(__s));} |
| 2039 | _LIBCPP_INLINE_VISIBILITY |
| 2040 | bool compare_exchange_weak(signed char& __v, signed char __e, |
| 2041 | memory_order __s = memory_order_seq_cst) |
| 2042 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 2043 | __translate_memory_order(__s));} |
| 2044 | _LIBCPP_INLINE_VISIBILITY |
| 2045 | bool compare_exchange_strong(signed char& __v, signed char __e, |
| 2046 | memory_order __s = memory_order_seq_cst) volatile |
| 2047 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 2048 | __translate_memory_order(__s));} |
| 2049 | _LIBCPP_INLINE_VISIBILITY |
| 2050 | bool compare_exchange_strong(signed char& __v, signed char __e, |
| 2051 | memory_order __s = memory_order_seq_cst) |
| 2052 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 2053 | __translate_memory_order(__s));} |
| 2054 | _LIBCPP_INLINE_VISIBILITY |
| 2055 | signed char fetch_add(signed char __v, |
| 2056 | memory_order __o = memory_order_seq_cst) volatile |
| 2057 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 2058 | _LIBCPP_INLINE_VISIBILITY |
| 2059 | signed char fetch_add(signed char __v, |
| 2060 | memory_order __o = memory_order_seq_cst) |
| 2061 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 2062 | _LIBCPP_INLINE_VISIBILITY |
| 2063 | signed char fetch_sub(signed char __v, |
| 2064 | memory_order __o = memory_order_seq_cst) volatile |
| 2065 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 2066 | _LIBCPP_INLINE_VISIBILITY |
| 2067 | signed char fetch_sub(signed char __v, |
| 2068 | memory_order __o = memory_order_seq_cst) |
| 2069 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 2070 | _LIBCPP_INLINE_VISIBILITY |
| 2071 | signed char fetch_and(signed char __v, |
| 2072 | memory_order __o = memory_order_seq_cst) volatile |
| 2073 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 2074 | _LIBCPP_INLINE_VISIBILITY |
| 2075 | signed char fetch_and(signed char __v, |
| 2076 | memory_order __o = memory_order_seq_cst) |
| 2077 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 2078 | _LIBCPP_INLINE_VISIBILITY |
| 2079 | signed char fetch_or(signed char __v, |
| 2080 | memory_order __o = memory_order_seq_cst) volatile |
| 2081 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 2082 | _LIBCPP_INLINE_VISIBILITY |
| 2083 | signed char fetch_or(signed char __v, |
| 2084 | memory_order __o = memory_order_seq_cst) |
| 2085 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 2086 | _LIBCPP_INLINE_VISIBILITY |
| 2087 | signed char fetch_xor(signed char __v, |
| 2088 | memory_order __o = memory_order_seq_cst) volatile |
| 2089 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 2090 | _LIBCPP_INLINE_VISIBILITY |
| 2091 | signed char fetch_xor(signed char __v, |
| 2092 | memory_order __o = memory_order_seq_cst) |
| 2093 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 2094 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 2095 | atomic_schar() = default; |
| 2096 | #else |
| 2097 | _LIBCPP_INLINE_VISIBILITY |
| 2098 | atomic_schar() {} |
| 2099 | #endif |
| 2100 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 2101 | constexpr atomic_schar(signed char __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 2102 | : __v_(__v) {} |
| 2103 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 2104 | atomic_schar(const atomic_schar&) = delete; |
| 2105 | atomic_schar& operator=(const atomic_schar&) = delete; |
| 2106 | atomic_schar& operator=(const atomic_schar&) volatile = delete; |
| 2107 | #else |
| 2108 | private: |
| 2109 | atomic_schar(const atomic_schar&); |
| 2110 | atomic_schar& operator=(const atomic_schar&); |
| 2111 | atomic_schar& operator=(const atomic_schar&) volatile; |
| 2112 | public: |
| 2113 | #endif |
| 2114 | _LIBCPP_INLINE_VISIBILITY |
| 2115 | signed char operator=(signed char __v) volatile |
| 2116 | {store(__v); return __v;} |
| 2117 | _LIBCPP_INLINE_VISIBILITY |
| 2118 | signed char operator=(signed char __v) |
| 2119 | {store(__v); return __v;} |
| 2120 | _LIBCPP_INLINE_VISIBILITY |
| 2121 | signed char operator++(int) volatile |
| 2122 | {typedef signed char type; return fetch_add(type(1));} |
| 2123 | _LIBCPP_INLINE_VISIBILITY |
| 2124 | char operator++(int) |
| 2125 | {typedef signed char type; return fetch_add(type(1));} |
| 2126 | _LIBCPP_INLINE_VISIBILITY |
| 2127 | char operator--(int) volatile |
| 2128 | {typedef signed char type; return fetch_sub(type(1));} |
| 2129 | _LIBCPP_INLINE_VISIBILITY |
| 2130 | char operator--(int) |
| 2131 | {typedef signed char type; return fetch_sub(type(1));} |
| 2132 | _LIBCPP_INLINE_VISIBILITY |
| 2133 | char operator++() volatile |
| 2134 | {typedef signed char type; return type(fetch_add(type(1)) + 1);} |
| 2135 | _LIBCPP_INLINE_VISIBILITY |
| 2136 | char operator++() |
| 2137 | {typedef signed char type; return type(fetch_add(type(1)) + 1);} |
| 2138 | _LIBCPP_INLINE_VISIBILITY |
| 2139 | char operator--() volatile |
| 2140 | {typedef signed char type; return type(fetch_sub(type(1)) - 1);} |
| 2141 | _LIBCPP_INLINE_VISIBILITY |
| 2142 | char operator--() |
| 2143 | {typedef signed char type; return type(fetch_sub(type(1)) - 1);} |
| 2144 | _LIBCPP_INLINE_VISIBILITY |
| 2145 | char operator+=(char __v) volatile |
| 2146 | {typedef signed char type; return type(fetch_add(__v) + __v);} |
| 2147 | _LIBCPP_INLINE_VISIBILITY |
| 2148 | char operator+=(char __v) |
| 2149 | {typedef signed char type; return type(fetch_add(__v) + __v);} |
| 2150 | _LIBCPP_INLINE_VISIBILITY |
| 2151 | char operator-=(char __v) volatile |
| 2152 | {typedef signed char type; return type(fetch_sub(__v) - __v);} |
| 2153 | _LIBCPP_INLINE_VISIBILITY |
| 2154 | char operator-=(char __v) |
| 2155 | {typedef signed char type; return type(fetch_sub(__v) - __v);} |
| 2156 | _LIBCPP_INLINE_VISIBILITY |
| 2157 | char operator&=(char __v) volatile |
| 2158 | {typedef signed char type; return type(fetch_and(__v) & __v);} |
| 2159 | _LIBCPP_INLINE_VISIBILITY |
| 2160 | char operator&=(char __v) |
| 2161 | {typedef signed char type; return type(fetch_and(__v) & __v);} |
| 2162 | _LIBCPP_INLINE_VISIBILITY |
| 2163 | char operator|=(char __v) volatile |
| 2164 | {typedef signed char type; return type(fetch_or(__v) | __v);} |
| 2165 | _LIBCPP_INLINE_VISIBILITY |
| 2166 | char operator|=(char __v) |
| 2167 | {typedef signed char type; return type(fetch_or(__v) | __v);} |
| 2168 | _LIBCPP_INLINE_VISIBILITY |
| 2169 | char operator^=(char __v) volatile |
| 2170 | {typedef signed char type; return type(fetch_xor(__v) ^ __v);} |
| 2171 | _LIBCPP_INLINE_VISIBILITY |
| 2172 | char operator^=(char __v) |
| 2173 | {typedef signed char type; return type(fetch_xor(__v) ^ __v);} |
| 2174 | } atomic_schar; |
| 2175 | |
| 2176 | inline _LIBCPP_INLINE_VISIBILITY |
| 2177 | bool |
| 2178 | atomic_is_lock_free(const volatile atomic_schar*) |
| 2179 | { |
| 2180 | typedef signed char type; |
| 2181 | return __atomic_is_lock_free(type); |
| 2182 | } |
| 2183 | |
| 2184 | inline _LIBCPP_INLINE_VISIBILITY |
| 2185 | bool |
| 2186 | atomic_is_lock_free(const atomic_schar* __obj) |
| 2187 | { |
| 2188 | return atomic_is_lock_free(const_cast<volatile atomic_schar*>(__obj)); |
| 2189 | } |
| 2190 | |
| 2191 | inline _LIBCPP_INLINE_VISIBILITY |
| 2192 | void |
| 2193 | atomic_init(volatile atomic_schar* __obj, signed char __desr) |
| 2194 | { |
| 2195 | __obj->__v_ = __desr; |
| 2196 | } |
| 2197 | |
| 2198 | inline _LIBCPP_INLINE_VISIBILITY |
| 2199 | void |
| 2200 | atomic_init(atomic_schar* __obj, signed char __desr) |
| 2201 | { |
| 2202 | __obj->__v_ = __desr; |
| 2203 | } |
| 2204 | |
| 2205 | inline _LIBCPP_INLINE_VISIBILITY |
| 2206 | void |
| 2207 | atomic_store(volatile atomic_schar* __obj, signed char __desr) |
| 2208 | { |
| 2209 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 2210 | } |
| 2211 | |
| 2212 | inline _LIBCPP_INLINE_VISIBILITY |
| 2213 | void |
| 2214 | atomic_store(atomic_schar* __obj, signed char __desr) |
| 2215 | { |
| 2216 | atomic_store(const_cast<volatile atomic_schar*>(__obj), __desr); |
| 2217 | } |
| 2218 | |
| 2219 | inline _LIBCPP_INLINE_VISIBILITY |
| 2220 | void |
| 2221 | atomic_store_explicit(volatile atomic_schar* __obj, signed char __desr, |
| 2222 | memory_order __o) |
| 2223 | { |
| 2224 | __atomic_store(&__obj->__v_, __desr, __o); |
| 2225 | } |
| 2226 | |
| 2227 | inline _LIBCPP_INLINE_VISIBILITY |
| 2228 | void |
| 2229 | atomic_store_explicit(atomic_schar* __obj, signed char __desr, memory_order __o) |
| 2230 | { |
| 2231 | atomic_store_explicit(const_cast<volatile atomic_schar*>(__obj), __desr, |
| 2232 | __o); |
| 2233 | } |
| 2234 | |
| 2235 | inline _LIBCPP_INLINE_VISIBILITY |
| 2236 | signed char |
| 2237 | atomic_load(const volatile atomic_schar* __obj) |
| 2238 | { |
| 2239 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 2240 | } |
| 2241 | |
| 2242 | inline _LIBCPP_INLINE_VISIBILITY |
| 2243 | signed char |
| 2244 | atomic_load(const atomic_schar* __obj) |
| 2245 | { |
| 2246 | return atomic_load(const_cast<const volatile atomic_schar*>(__obj)); |
| 2247 | } |
| 2248 | |
| 2249 | inline _LIBCPP_INLINE_VISIBILITY |
| 2250 | signed char |
| 2251 | atomic_load_explicit(const volatile atomic_schar* __obj, memory_order __o) |
| 2252 | { |
| 2253 | return __atomic_load(&__obj->__v_, __o); |
| 2254 | } |
| 2255 | |
| 2256 | inline _LIBCPP_INLINE_VISIBILITY |
| 2257 | signed char |
| 2258 | atomic_load_explicit(const atomic_schar* __obj, memory_order __o) |
| 2259 | { |
| 2260 | return atomic_load_explicit(const_cast<const volatile atomic_schar*> |
| 2261 | (__obj), __o); |
| 2262 | } |
| 2263 | |
| 2264 | inline _LIBCPP_INLINE_VISIBILITY |
| 2265 | signed char |
| 2266 | atomic_exchange(volatile atomic_schar* __obj, signed char __desr) |
| 2267 | { |
| 2268 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 2269 | } |
| 2270 | |
| 2271 | inline _LIBCPP_INLINE_VISIBILITY |
| 2272 | signed char |
| 2273 | atomic_exchange(atomic_schar* __obj, signed char __desr) |
| 2274 | { |
| 2275 | return atomic_exchange(const_cast<volatile atomic_schar*>(__obj), __desr); |
| 2276 | } |
| 2277 | |
| 2278 | inline _LIBCPP_INLINE_VISIBILITY |
| 2279 | signed char |
| 2280 | atomic_exchange_explicit(volatile atomic_schar* __obj, signed char __desr, |
| 2281 | memory_order __o) |
| 2282 | { |
| 2283 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 2284 | } |
| 2285 | |
| 2286 | inline _LIBCPP_INLINE_VISIBILITY |
| 2287 | signed char |
| 2288 | atomic_exchange_explicit(atomic_schar* __obj, signed char __desr, |
| 2289 | memory_order __o) |
| 2290 | { |
| 2291 | return atomic_exchange_explicit(const_cast<volatile atomic_schar*> |
| 2292 | (__obj), __desr, __o); |
| 2293 | } |
| 2294 | |
| 2295 | inline _LIBCPP_INLINE_VISIBILITY |
| 2296 | bool |
| 2297 | atomic_compare_exchange_weak(volatile atomic_schar* __obj, signed char* __exp, |
| 2298 | signed char __desr) |
| 2299 | { |
| 2300 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 2301 | memory_order_seq_cst, memory_order_seq_cst); |
| 2302 | } |
| 2303 | |
| 2304 | inline _LIBCPP_INLINE_VISIBILITY |
| 2305 | bool |
| 2306 | atomic_compare_exchange_weak(atomic_schar* __obj, signed char* __exp, |
| 2307 | signed char __desr) |
| 2308 | { |
| 2309 | return atomic_compare_exchange_weak(const_cast<volatile atomic_schar*> |
| 2310 | (__obj), __exp, __desr); |
| 2311 | } |
| 2312 | |
| 2313 | inline _LIBCPP_INLINE_VISIBILITY |
| 2314 | bool |
| 2315 | atomic_compare_exchange_strong(volatile atomic_schar* __obj, signed char* __exp, |
| 2316 | signed char __desr) |
| 2317 | { |
| 2318 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 2319 | memory_order_seq_cst, memory_order_seq_cst); |
| 2320 | } |
| 2321 | |
| 2322 | inline _LIBCPP_INLINE_VISIBILITY |
| 2323 | bool |
| 2324 | atomic_compare_exchange_strong(atomic_schar* __obj, signed char* __exp, |
| 2325 | signed char __desr) |
| 2326 | { |
| 2327 | return atomic_compare_exchange_strong(const_cast<volatile atomic_schar*> |
| 2328 | (__obj), __exp, __desr); |
| 2329 | } |
| 2330 | |
| 2331 | inline _LIBCPP_INLINE_VISIBILITY |
| 2332 | bool |
| 2333 | atomic_compare_exchange_weak_explicit(volatile atomic_schar* __obj, |
| 2334 | signed char* __exp, signed char __desr, |
| 2335 | memory_order __s, memory_order __f) |
| 2336 | { |
| 2337 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 2338 | __f); |
| 2339 | } |
| 2340 | |
| 2341 | inline _LIBCPP_INLINE_VISIBILITY |
| 2342 | bool |
| 2343 | atomic_compare_exchange_weak_explicit(atomic_schar* __obj, signed char* __exp, |
| 2344 | signed char __desr, memory_order __s, |
| 2345 | memory_order __f) |
| 2346 | { |
| 2347 | return atomic_compare_exchange_weak_explicit( |
| 2348 | const_cast<volatile atomic_schar*>(__obj), __exp, __desr, __s, __f); |
| 2349 | } |
| 2350 | |
| 2351 | inline _LIBCPP_INLINE_VISIBILITY |
| 2352 | bool |
| 2353 | atomic_compare_exchange_strong_explicit(volatile atomic_schar* __obj, |
| 2354 | signed char* __exp, signed char __desr, |
| 2355 | memory_order __s, memory_order __f) |
| 2356 | { |
| 2357 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 2358 | __f); |
| 2359 | } |
| 2360 | |
| 2361 | inline _LIBCPP_INLINE_VISIBILITY |
| 2362 | bool |
| 2363 | atomic_compare_exchange_strong_explicit(atomic_schar* __obj, signed char* __exp, |
| 2364 | signed char __desr, memory_order __s, |
| 2365 | memory_order __f) |
| 2366 | { |
| 2367 | return atomic_compare_exchange_strong_explicit( |
| 2368 | const_cast<volatile atomic_schar*>(__obj), __exp, __desr, __s, __f); |
| 2369 | } |
| 2370 | |
| 2371 | inline _LIBCPP_INLINE_VISIBILITY |
| 2372 | signed char |
| 2373 | atomic_fetch_add(volatile atomic_schar* __obj, signed char __v) |
| 2374 | { |
| 2375 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 2376 | } |
| 2377 | |
| 2378 | inline _LIBCPP_INLINE_VISIBILITY |
| 2379 | signed char |
| 2380 | atomic_fetch_add(atomic_schar* __obj, signed char __v) |
| 2381 | { |
| 2382 | return atomic_fetch_add(const_cast<volatile atomic_schar*>(__obj), __v); |
| 2383 | } |
| 2384 | |
| 2385 | inline _LIBCPP_INLINE_VISIBILITY |
| 2386 | signed char |
| 2387 | atomic_fetch_add_explicit(volatile atomic_schar* __obj, signed char __v, |
| 2388 | memory_order __o) |
| 2389 | { |
| 2390 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 2391 | } |
| 2392 | |
| 2393 | inline _LIBCPP_INLINE_VISIBILITY |
| 2394 | signed char |
| 2395 | atomic_fetch_add_explicit(atomic_schar* __obj, signed char __v, |
| 2396 | memory_order __o) |
| 2397 | { |
| 2398 | return atomic_fetch_add_explicit(const_cast<volatile atomic_schar*>(__obj), |
| 2399 | __v, __o); |
| 2400 | } |
| 2401 | |
| 2402 | inline _LIBCPP_INLINE_VISIBILITY |
| 2403 | signed char |
| 2404 | atomic_fetch_sub(volatile atomic_schar* __obj, signed char __v) |
| 2405 | { |
| 2406 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 2407 | } |
| 2408 | |
| 2409 | inline _LIBCPP_INLINE_VISIBILITY |
| 2410 | signed char |
| 2411 | atomic_fetch_sub(atomic_schar* __obj, signed char __v) |
| 2412 | { |
| 2413 | return atomic_fetch_sub(const_cast<volatile atomic_schar*>(__obj), __v); |
| 2414 | } |
| 2415 | |
| 2416 | inline _LIBCPP_INLINE_VISIBILITY |
| 2417 | signed char |
| 2418 | atomic_fetch_sub_explicit(volatile atomic_schar* __obj, signed char __v, |
| 2419 | memory_order __o) |
| 2420 | { |
| 2421 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 2422 | } |
| 2423 | |
| 2424 | inline _LIBCPP_INLINE_VISIBILITY |
| 2425 | signed char |
| 2426 | atomic_fetch_sub_explicit(atomic_schar* __obj, signed char __v, |
| 2427 | memory_order __o) |
| 2428 | { |
| 2429 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_schar*>(__obj), |
| 2430 | __v, __o); |
| 2431 | } |
| 2432 | |
| 2433 | inline _LIBCPP_INLINE_VISIBILITY |
| 2434 | signed char |
| 2435 | atomic_fetch_and(volatile atomic_schar* __obj, signed char __v) |
| 2436 | { |
| 2437 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 2438 | } |
| 2439 | |
| 2440 | inline _LIBCPP_INLINE_VISIBILITY |
| 2441 | signed char |
| 2442 | atomic_fetch_and(atomic_schar* __obj, signed char __v) |
| 2443 | { |
| 2444 | return atomic_fetch_and(const_cast<volatile atomic_schar*>(__obj), __v); |
| 2445 | } |
| 2446 | |
| 2447 | inline _LIBCPP_INLINE_VISIBILITY |
| 2448 | signed char |
| 2449 | atomic_fetch_and_explicit(volatile atomic_schar* __obj, signed char __v, |
| 2450 | memory_order __o) |
| 2451 | { |
| 2452 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 2453 | } |
| 2454 | |
| 2455 | inline _LIBCPP_INLINE_VISIBILITY |
| 2456 | signed char |
| 2457 | atomic_fetch_and_explicit(atomic_schar* __obj, signed char __v, |
| 2458 | memory_order __o) |
| 2459 | { |
| 2460 | return atomic_fetch_and_explicit(const_cast<volatile atomic_schar*>(__obj), |
| 2461 | __v, __o); |
| 2462 | } |
| 2463 | |
| 2464 | inline _LIBCPP_INLINE_VISIBILITY |
| 2465 | signed char |
| 2466 | atomic_fetch_or(volatile atomic_schar* __obj, signed char __v) |
| 2467 | { |
| 2468 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 2469 | } |
| 2470 | |
| 2471 | inline _LIBCPP_INLINE_VISIBILITY |
| 2472 | signed char |
| 2473 | atomic_fetch_or(atomic_schar* __obj, signed char __v) |
| 2474 | { |
| 2475 | return atomic_fetch_or(const_cast<volatile atomic_schar*>(__obj), __v); |
| 2476 | } |
| 2477 | |
| 2478 | inline _LIBCPP_INLINE_VISIBILITY |
| 2479 | signed char |
| 2480 | atomic_fetch_or_explicit(volatile atomic_schar* __obj, signed char __v, |
| 2481 | memory_order __o) |
| 2482 | { |
| 2483 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 2484 | } |
| 2485 | |
| 2486 | inline _LIBCPP_INLINE_VISIBILITY |
| 2487 | signed char |
| 2488 | atomic_fetch_or_explicit(atomic_schar* __obj, signed char __v, memory_order __o) |
| 2489 | { |
| 2490 | return atomic_fetch_or_explicit(const_cast<volatile atomic_schar*>(__obj), |
| 2491 | __v, __o); |
| 2492 | } |
| 2493 | |
| 2494 | inline _LIBCPP_INLINE_VISIBILITY |
| 2495 | signed char |
| 2496 | atomic_fetch_xor(volatile atomic_schar* __obj, signed char __v) |
| 2497 | { |
| 2498 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 2499 | } |
| 2500 | |
| 2501 | inline _LIBCPP_INLINE_VISIBILITY |
| 2502 | signed char |
| 2503 | atomic_fetch_xor(atomic_schar* __obj, signed char __v) |
| 2504 | { |
| 2505 | return atomic_fetch_xor(const_cast<volatile atomic_schar*>(__obj), __v); |
| 2506 | } |
| 2507 | |
| 2508 | inline _LIBCPP_INLINE_VISIBILITY |
| 2509 | signed char |
| 2510 | atomic_fetch_xor_explicit(volatile atomic_schar* __obj, signed char __v, |
| 2511 | memory_order __o) |
| 2512 | { |
| 2513 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 2514 | } |
| 2515 | |
| 2516 | inline _LIBCPP_INLINE_VISIBILITY |
| 2517 | signed char |
| 2518 | atomic_fetch_xor_explicit(atomic_schar* __obj, signed char __v, |
| 2519 | memory_order __o) |
| 2520 | { |
| 2521 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_schar*>(__obj), |
| 2522 | __v, __o); |
| 2523 | } |
| 2524 | |
| 2525 | // atomic_uchar |
| 2526 | |
| 2527 | struct atomic_uchar; |
| 2528 | |
| 2529 | bool atomic_is_lock_free(const volatile atomic_uchar*); |
| 2530 | bool atomic_is_lock_free(const atomic_uchar*); |
| 2531 | void atomic_init(volatile atomic_uchar*, unsigned char); |
| 2532 | void atomic_init(atomic_uchar*, unsigned char); |
| 2533 | void atomic_store(volatile atomic_uchar*, unsigned char); |
| 2534 | void atomic_store(atomic_uchar*, unsigned char); |
| 2535 | void atomic_store_explicit(volatile atomic_uchar*, unsigned char, memory_order); |
| 2536 | void atomic_store_explicit(atomic_uchar*, unsigned char, memory_order); |
| 2537 | unsigned char atomic_load(const volatile atomic_uchar*); |
| 2538 | unsigned char atomic_load(const atomic_uchar*); |
| 2539 | unsigned char atomic_load_explicit(const volatile atomic_uchar*, memory_order); |
| 2540 | unsigned char atomic_load_explicit(const atomic_uchar*, memory_order); |
| 2541 | unsigned char atomic_exchange(volatile atomic_uchar*, unsigned char); |
| 2542 | unsigned char atomic_exchange(atomic_uchar*, unsigned char); |
| 2543 | unsigned char atomic_exchange_explicit(volatile atomic_uchar*, unsigned char, |
| 2544 | memory_order); |
| 2545 | unsigned char atomic_exchange_explicit(atomic_uchar*, unsigned char, |
| 2546 | memory_order); |
| 2547 | bool atomic_compare_exchange_weak(volatile atomic_uchar*, unsigned char*, |
| 2548 | unsigned char); |
| 2549 | bool atomic_compare_exchange_weak(atomic_uchar*, unsigned char*, unsigned char); |
| 2550 | bool atomic_compare_exchange_strong(volatile atomic_uchar*, unsigned char*, |
| 2551 | unsigned char); |
| 2552 | bool atomic_compare_exchange_strong(atomic_uchar*, unsigned char*, |
| 2553 | unsigned char); |
| 2554 | bool atomic_compare_exchange_weak_explicit(volatile atomic_uchar*, |
| 2555 | unsigned char*, unsigned char, |
| 2556 | memory_order, memory_order); |
| 2557 | bool atomic_compare_exchange_weak_explicit(atomic_uchar*, unsigned char*, |
| 2558 | unsigned char, memory_order, |
| 2559 | memory_order); |
| 2560 | bool atomic_compare_exchange_strong_explicit(volatile atomic_uchar*, |
| 2561 | unsigned char*, unsigned char, |
| 2562 | memory_order, memory_order); |
| 2563 | bool atomic_compare_exchange_strong_explicit(atomic_uchar*, unsigned char*, |
| 2564 | unsigned char, memory_order, |
| 2565 | memory_order); |
| 2566 | unsigned char atomic_fetch_add(volatile atomic_uchar*, unsigned char); |
| 2567 | unsigned char atomic_fetch_add(atomic_uchar*, unsigned char); |
| 2568 | unsigned char atomic_fetch_add_explicit(volatile atomic_uchar*, unsigned char, |
| 2569 | memory_order); |
| 2570 | unsigned char atomic_fetch_add_explicit(atomic_uchar*, unsigned char, |
| 2571 | memory_order); |
| 2572 | unsigned char atomic_fetch_sub(volatile atomic_uchar*, unsigned char); |
| 2573 | unsigned char atomic_fetch_sub(atomic_uchar*, unsigned char); |
| 2574 | unsigned char atomic_fetch_sub_explicit(volatile atomic_uchar*, unsigned char, |
| 2575 | memory_order); |
| 2576 | unsigned char atomic_fetch_sub_explicit(atomic_uchar*, unsigned char, |
| 2577 | memory_order); |
| 2578 | unsigned char atomic_fetch_and(volatile atomic_uchar*, unsigned char); |
| 2579 | unsigned char atomic_fetch_and(atomic_uchar*, unsigned char); |
| 2580 | unsigned char atomic_fetch_and_explicit(volatile atomic_uchar*, unsigned char, |
| 2581 | memory_order); |
| 2582 | unsigned char atomic_fetch_and_explicit(atomic_uchar*, unsigned char, |
| 2583 | memory_order); |
| 2584 | unsigned char atomic_fetch_or(volatile atomic_uchar*, unsigned char); |
| 2585 | unsigned char atomic_fetch_or(atomic_uchar*, unsigned char); |
| 2586 | unsigned char atomic_fetch_or_explicit(volatile atomic_uchar*, unsigned char, |
| 2587 | memory_order); |
| 2588 | unsigned char atomic_fetch_or_explicit(atomic_uchar*, unsigned char, |
| 2589 | memory_order); |
| 2590 | unsigned char atomic_fetch_xor(volatile atomic_uchar*, unsigned char); |
| 2591 | unsigned char atomic_fetch_xor(atomic_uchar*, unsigned char); |
| 2592 | unsigned char atomic_fetch_xor_explicit(volatile atomic_uchar*, unsigned char, |
| 2593 | memory_order); |
| 2594 | unsigned char atomic_fetch_xor_explicit(atomic_uchar*, unsigned char, |
| 2595 | memory_order); |
| 2596 | |
| 2597 | typedef struct atomic_uchar |
| 2598 | { |
| 2599 | unsigned char __v_; |
| 2600 | |
| 2601 | _LIBCPP_INLINE_VISIBILITY |
| 2602 | bool is_lock_free() const volatile |
| 2603 | {return atomic_is_lock_free(this);} |
| 2604 | _LIBCPP_INLINE_VISIBILITY |
| 2605 | bool is_lock_free() const |
| 2606 | {return atomic_is_lock_free(this);} |
| 2607 | _LIBCPP_INLINE_VISIBILITY |
| 2608 | void store(unsigned char __v, |
| 2609 | memory_order __o = memory_order_seq_cst) volatile |
| 2610 | {atomic_store_explicit(this, __v, __o);} |
| 2611 | _LIBCPP_INLINE_VISIBILITY |
| 2612 | void store(unsigned char __v, memory_order __o = memory_order_seq_cst) |
| 2613 | {atomic_store_explicit(this, __v, __o);} |
| 2614 | _LIBCPP_INLINE_VISIBILITY |
| 2615 | unsigned char load(memory_order __o = memory_order_seq_cst) const volatile |
| 2616 | {return atomic_load_explicit(this, __o);} |
| 2617 | _LIBCPP_INLINE_VISIBILITY |
| 2618 | unsigned char load(memory_order __o = memory_order_seq_cst) const |
| 2619 | {return atomic_load_explicit(this, __o);} |
| 2620 | _LIBCPP_INLINE_VISIBILITY |
| 2621 | operator unsigned char() const volatile |
| 2622 | {return load();} |
| 2623 | _LIBCPP_INLINE_VISIBILITY |
| 2624 | operator unsigned char() const |
| 2625 | {return load();} |
| 2626 | _LIBCPP_INLINE_VISIBILITY |
| 2627 | unsigned char exchange(unsigned char __v, |
| 2628 | memory_order __o = memory_order_seq_cst) volatile |
| 2629 | {return atomic_exchange_explicit(this, __v, __o);} |
| 2630 | _LIBCPP_INLINE_VISIBILITY |
| 2631 | unsigned char exchange(unsigned char __v, |
| 2632 | memory_order __o = memory_order_seq_cst) |
| 2633 | {return atomic_exchange_explicit(this, __v, __o);} |
| 2634 | _LIBCPP_INLINE_VISIBILITY |
| 2635 | bool compare_exchange_weak(unsigned char& __v, unsigned char __e, |
| 2636 | memory_order __s, memory_order __f) volatile |
| 2637 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 2638 | __f);} |
| 2639 | _LIBCPP_INLINE_VISIBILITY |
| 2640 | bool compare_exchange_weak(unsigned char& __v, unsigned char __e, |
| 2641 | memory_order __s, memory_order __f) |
| 2642 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 2643 | __f);} |
| 2644 | _LIBCPP_INLINE_VISIBILITY |
| 2645 | bool compare_exchange_strong(unsigned char& __v, unsigned char __e, |
| 2646 | memory_order __s, memory_order __f) volatile |
| 2647 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 2648 | __f);} |
| 2649 | _LIBCPP_INLINE_VISIBILITY |
| 2650 | bool compare_exchange_strong(unsigned char& __v, unsigned char __e, |
| 2651 | memory_order __s, memory_order __f) |
| 2652 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 2653 | __f);} |
| 2654 | _LIBCPP_INLINE_VISIBILITY |
| 2655 | bool compare_exchange_weak(unsigned char& __v, unsigned char __e, |
| 2656 | memory_order __s = memory_order_seq_cst) volatile |
| 2657 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 2658 | __translate_memory_order(__s));} |
| 2659 | _LIBCPP_INLINE_VISIBILITY |
| 2660 | bool compare_exchange_weak(unsigned char& __v, unsigned char __e, |
| 2661 | memory_order __s = memory_order_seq_cst) |
| 2662 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 2663 | __translate_memory_order(__s));} |
| 2664 | _LIBCPP_INLINE_VISIBILITY |
| 2665 | bool compare_exchange_strong(unsigned char& __v, unsigned char __e, |
| 2666 | memory_order __s = memory_order_seq_cst) volatile |
| 2667 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 2668 | __translate_memory_order(__s));} |
| 2669 | _LIBCPP_INLINE_VISIBILITY |
| 2670 | bool compare_exchange_strong(unsigned char& __v, unsigned char __e, |
| 2671 | memory_order __s = memory_order_seq_cst) |
| 2672 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 2673 | __translate_memory_order(__s));} |
| 2674 | _LIBCPP_INLINE_VISIBILITY |
| 2675 | unsigned char fetch_add(unsigned char __v, |
| 2676 | memory_order __o = memory_order_seq_cst) volatile |
| 2677 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 2678 | _LIBCPP_INLINE_VISIBILITY |
| 2679 | unsigned char fetch_add(unsigned char __v, |
| 2680 | memory_order __o = memory_order_seq_cst) |
| 2681 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 2682 | _LIBCPP_INLINE_VISIBILITY |
| 2683 | unsigned char fetch_sub(unsigned char __v, |
| 2684 | memory_order __o = memory_order_seq_cst) volatile |
| 2685 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 2686 | _LIBCPP_INLINE_VISIBILITY |
| 2687 | unsigned char fetch_sub(unsigned char __v, |
| 2688 | memory_order __o = memory_order_seq_cst) |
| 2689 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 2690 | _LIBCPP_INLINE_VISIBILITY |
| 2691 | unsigned char fetch_and(unsigned char __v, |
| 2692 | memory_order __o = memory_order_seq_cst) volatile |
| 2693 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 2694 | _LIBCPP_INLINE_VISIBILITY |
| 2695 | unsigned char fetch_and(unsigned char __v, |
| 2696 | memory_order __o = memory_order_seq_cst) |
| 2697 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 2698 | _LIBCPP_INLINE_VISIBILITY |
| 2699 | unsigned char fetch_or(unsigned char __v, |
| 2700 | memory_order __o = memory_order_seq_cst) volatile |
| 2701 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 2702 | _LIBCPP_INLINE_VISIBILITY |
| 2703 | unsigned char fetch_or(unsigned char __v, |
| 2704 | memory_order __o = memory_order_seq_cst) |
| 2705 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 2706 | _LIBCPP_INLINE_VISIBILITY |
| 2707 | unsigned char fetch_xor(unsigned char __v, |
| 2708 | memory_order __o = memory_order_seq_cst) volatile |
| 2709 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 2710 | _LIBCPP_INLINE_VISIBILITY |
| 2711 | unsigned char fetch_xor(unsigned char __v, |
| 2712 | memory_order __o = memory_order_seq_cst) |
| 2713 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 2714 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 2715 | atomic_uchar() = default; |
| 2716 | #else |
| 2717 | _LIBCPP_INLINE_VISIBILITY |
| 2718 | atomic_uchar() {} |
| 2719 | #endif |
| 2720 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 2721 | constexpr atomic_uchar(unsigned char __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 2722 | : __v_(__v) {} |
| 2723 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 2724 | atomic_uchar(const atomic_uchar&) = delete; |
| 2725 | atomic_uchar& operator=(const atomic_uchar&) = delete; |
| 2726 | atomic_uchar& operator=(const atomic_uchar&) volatile = delete; |
| 2727 | #else |
| 2728 | private: |
| 2729 | atomic_uchar(const atomic_uchar&); |
| 2730 | atomic_uchar& operator=(const atomic_uchar&); |
| 2731 | atomic_uchar& operator=(const atomic_uchar&) volatile; |
| 2732 | public: |
| 2733 | #endif |
| 2734 | _LIBCPP_INLINE_VISIBILITY |
| 2735 | unsigned char operator=(unsigned char __v) volatile |
| 2736 | {store(__v); return __v;} |
| 2737 | _LIBCPP_INLINE_VISIBILITY |
| 2738 | unsigned char operator=(unsigned char __v) |
| 2739 | {store(__v); return __v;} |
| 2740 | _LIBCPP_INLINE_VISIBILITY |
| 2741 | unsigned char operator++(int) volatile |
| 2742 | {typedef unsigned char type; return fetch_add(type(1));} |
| 2743 | _LIBCPP_INLINE_VISIBILITY |
| 2744 | char operator++(int) |
| 2745 | {typedef unsigned char type; return fetch_add(type(1));} |
| 2746 | _LIBCPP_INLINE_VISIBILITY |
| 2747 | char operator--(int) volatile |
| 2748 | {typedef unsigned char type; return fetch_sub(type(1));} |
| 2749 | _LIBCPP_INLINE_VISIBILITY |
| 2750 | char operator--(int) |
| 2751 | {typedef unsigned char type; return fetch_sub(type(1));} |
| 2752 | _LIBCPP_INLINE_VISIBILITY |
| 2753 | char operator++() volatile |
| 2754 | {typedef unsigned char type; return type(fetch_add(type(1)) + 1);} |
| 2755 | _LIBCPP_INLINE_VISIBILITY |
| 2756 | char operator++() |
| 2757 | {typedef unsigned char type; return type(fetch_add(type(1)) + 1);} |
| 2758 | _LIBCPP_INLINE_VISIBILITY |
| 2759 | char operator--() volatile |
| 2760 | {typedef unsigned char type; return type(fetch_sub(type(1)) - 1);} |
| 2761 | _LIBCPP_INLINE_VISIBILITY |
| 2762 | char operator--() |
| 2763 | {typedef unsigned char type; return type(fetch_sub(type(1)) - 1);} |
| 2764 | _LIBCPP_INLINE_VISIBILITY |
| 2765 | char operator+=(char __v) volatile |
| 2766 | {typedef unsigned char type; return type(fetch_add(__v) + __v);} |
| 2767 | _LIBCPP_INLINE_VISIBILITY |
| 2768 | char operator+=(char __v) |
| 2769 | {typedef unsigned char type; return type(fetch_add(__v) + __v);} |
| 2770 | _LIBCPP_INLINE_VISIBILITY |
| 2771 | char operator-=(char __v) volatile |
| 2772 | {typedef unsigned char type; return type(fetch_sub(__v) - __v);} |
| 2773 | _LIBCPP_INLINE_VISIBILITY |
| 2774 | char operator-=(char __v) |
| 2775 | {typedef unsigned char type; return type(fetch_sub(__v) - __v);} |
| 2776 | _LIBCPP_INLINE_VISIBILITY |
| 2777 | char operator&=(char __v) volatile |
| 2778 | {typedef unsigned char type; return type(fetch_and(__v) & __v);} |
| 2779 | _LIBCPP_INLINE_VISIBILITY |
| 2780 | char operator&=(char __v) |
| 2781 | {typedef unsigned char type; return type(fetch_and(__v) & __v);} |
| 2782 | _LIBCPP_INLINE_VISIBILITY |
| 2783 | char operator|=(char __v) volatile |
| 2784 | {typedef unsigned char type; return type(fetch_or(__v) | __v);} |
| 2785 | _LIBCPP_INLINE_VISIBILITY |
| 2786 | char operator|=(char __v) |
| 2787 | {typedef unsigned char type; return type(fetch_or(__v) | __v);} |
| 2788 | _LIBCPP_INLINE_VISIBILITY |
| 2789 | char operator^=(char __v) volatile |
| 2790 | {typedef unsigned char type; return type(fetch_xor(__v) ^ __v);} |
| 2791 | _LIBCPP_INLINE_VISIBILITY |
| 2792 | char operator^=(char __v) |
| 2793 | {typedef unsigned char type; return type(fetch_xor(__v) ^ __v);} |
| 2794 | } atomic_uchar; |
| 2795 | |
| 2796 | inline _LIBCPP_INLINE_VISIBILITY |
| 2797 | bool |
| 2798 | atomic_is_lock_free(const volatile atomic_uchar*) |
| 2799 | { |
| 2800 | typedef unsigned char type; |
| 2801 | return __atomic_is_lock_free(type); |
| 2802 | } |
| 2803 | |
| 2804 | inline _LIBCPP_INLINE_VISIBILITY |
| 2805 | bool |
| 2806 | atomic_is_lock_free(const atomic_uchar* __obj) |
| 2807 | { |
| 2808 | return atomic_is_lock_free(const_cast<volatile atomic_uchar*>(__obj)); |
| 2809 | } |
| 2810 | |
| 2811 | inline _LIBCPP_INLINE_VISIBILITY |
| 2812 | void |
| 2813 | atomic_init(volatile atomic_uchar* __obj, unsigned char __desr) |
| 2814 | { |
| 2815 | __obj->__v_ = __desr; |
| 2816 | } |
| 2817 | |
| 2818 | inline _LIBCPP_INLINE_VISIBILITY |
| 2819 | void |
| 2820 | atomic_init(atomic_uchar* __obj, unsigned char __desr) |
| 2821 | { |
| 2822 | __obj->__v_ = __desr; |
| 2823 | } |
| 2824 | |
| 2825 | inline _LIBCPP_INLINE_VISIBILITY |
| 2826 | void |
| 2827 | atomic_store(volatile atomic_uchar* __obj, unsigned char __desr) |
| 2828 | { |
| 2829 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 2830 | } |
| 2831 | |
| 2832 | inline _LIBCPP_INLINE_VISIBILITY |
| 2833 | void |
| 2834 | atomic_store(atomic_uchar* __obj, unsigned char __desr) |
| 2835 | { |
| 2836 | atomic_store(const_cast<volatile atomic_uchar*>(__obj), __desr); |
| 2837 | } |
| 2838 | |
| 2839 | inline _LIBCPP_INLINE_VISIBILITY |
| 2840 | void |
| 2841 | atomic_store_explicit(volatile atomic_uchar* __obj, unsigned char __desr, |
| 2842 | memory_order __o) |
| 2843 | { |
| 2844 | __atomic_store(&__obj->__v_, __desr, __o); |
| 2845 | } |
| 2846 | |
| 2847 | inline _LIBCPP_INLINE_VISIBILITY |
| 2848 | void |
| 2849 | atomic_store_explicit(atomic_uchar* __obj, unsigned char __desr, |
| 2850 | memory_order __o) |
| 2851 | { |
| 2852 | atomic_store_explicit(const_cast<volatile atomic_uchar*>(__obj), __desr, |
| 2853 | __o); |
| 2854 | } |
| 2855 | |
| 2856 | inline _LIBCPP_INLINE_VISIBILITY |
| 2857 | unsigned char |
| 2858 | atomic_load(const volatile atomic_uchar* __obj) |
| 2859 | { |
| 2860 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 2861 | } |
| 2862 | |
| 2863 | inline _LIBCPP_INLINE_VISIBILITY |
| 2864 | unsigned char |
| 2865 | atomic_load(const atomic_uchar* __obj) |
| 2866 | { |
| 2867 | return atomic_load(const_cast<const volatile atomic_uchar*>(__obj)); |
| 2868 | } |
| 2869 | |
| 2870 | inline _LIBCPP_INLINE_VISIBILITY |
| 2871 | unsigned char |
| 2872 | atomic_load_explicit(const volatile atomic_uchar* __obj, memory_order __o) |
| 2873 | { |
| 2874 | return __atomic_load(&__obj->__v_, __o); |
| 2875 | } |
| 2876 | |
| 2877 | inline _LIBCPP_INLINE_VISIBILITY |
| 2878 | unsigned char |
| 2879 | atomic_load_explicit(const atomic_uchar* __obj, memory_order __o) |
| 2880 | { |
| 2881 | return atomic_load_explicit(const_cast<const volatile atomic_uchar*> |
| 2882 | (__obj), __o); |
| 2883 | } |
| 2884 | |
| 2885 | inline _LIBCPP_INLINE_VISIBILITY |
| 2886 | unsigned char |
| 2887 | atomic_exchange(volatile atomic_uchar* __obj, unsigned char __desr) |
| 2888 | { |
| 2889 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 2890 | } |
| 2891 | |
| 2892 | inline _LIBCPP_INLINE_VISIBILITY |
| 2893 | unsigned char |
| 2894 | atomic_exchange(atomic_uchar* __obj, unsigned char __desr) |
| 2895 | { |
| 2896 | return atomic_exchange(const_cast<volatile atomic_uchar*>(__obj), __desr); |
| 2897 | } |
| 2898 | |
| 2899 | inline _LIBCPP_INLINE_VISIBILITY |
| 2900 | unsigned char |
| 2901 | atomic_exchange_explicit(volatile atomic_uchar* __obj, unsigned char __desr, |
| 2902 | memory_order __o) |
| 2903 | { |
| 2904 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 2905 | } |
| 2906 | |
| 2907 | inline _LIBCPP_INLINE_VISIBILITY |
| 2908 | unsigned char |
| 2909 | atomic_exchange_explicit(atomic_uchar* __obj, unsigned char __desr, |
| 2910 | memory_order __o) |
| 2911 | { |
| 2912 | return atomic_exchange_explicit(const_cast<volatile atomic_uchar*> |
| 2913 | (__obj), __desr, __o); |
| 2914 | } |
| 2915 | |
| 2916 | inline _LIBCPP_INLINE_VISIBILITY |
| 2917 | bool |
| 2918 | atomic_compare_exchange_weak(volatile atomic_uchar* __obj, unsigned char* __exp, |
| 2919 | unsigned char __desr) |
| 2920 | { |
| 2921 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 2922 | memory_order_seq_cst, memory_order_seq_cst); |
| 2923 | } |
| 2924 | |
| 2925 | inline _LIBCPP_INLINE_VISIBILITY |
| 2926 | bool |
| 2927 | atomic_compare_exchange_weak(atomic_uchar* __obj, unsigned char* __exp, |
| 2928 | unsigned char __desr) |
| 2929 | { |
| 2930 | return atomic_compare_exchange_weak(const_cast<volatile atomic_uchar*> |
| 2931 | (__obj), __exp, __desr); |
| 2932 | } |
| 2933 | |
| 2934 | inline _LIBCPP_INLINE_VISIBILITY |
| 2935 | bool |
| 2936 | atomic_compare_exchange_strong(volatile atomic_uchar* __obj, |
| 2937 | unsigned char* __exp, unsigned char __desr) |
| 2938 | { |
| 2939 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 2940 | memory_order_seq_cst, memory_order_seq_cst); |
| 2941 | } |
| 2942 | |
| 2943 | inline _LIBCPP_INLINE_VISIBILITY |
| 2944 | bool |
| 2945 | atomic_compare_exchange_strong(atomic_uchar* __obj, unsigned char* __exp, |
| 2946 | unsigned char __desr) |
| 2947 | { |
| 2948 | return atomic_compare_exchange_strong(const_cast<volatile atomic_uchar*> |
| 2949 | (__obj), __exp, __desr); |
| 2950 | } |
| 2951 | |
| 2952 | inline _LIBCPP_INLINE_VISIBILITY |
| 2953 | bool |
| 2954 | atomic_compare_exchange_weak_explicit(volatile atomic_uchar* __obj, |
| 2955 | unsigned char* __exp, |
| 2956 | unsigned char __desr, memory_order __s, |
| 2957 | memory_order __f) |
| 2958 | { |
| 2959 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 2960 | __f); |
| 2961 | } |
| 2962 | |
| 2963 | inline _LIBCPP_INLINE_VISIBILITY |
| 2964 | bool |
| 2965 | atomic_compare_exchange_weak_explicit(atomic_uchar* __obj, unsigned char* __exp, |
| 2966 | unsigned char __desr, memory_order __s, |
| 2967 | memory_order __f) |
| 2968 | { |
| 2969 | return atomic_compare_exchange_weak_explicit( |
| 2970 | const_cast<volatile atomic_uchar*>(__obj), __exp, __desr, __s, __f); |
| 2971 | } |
| 2972 | |
| 2973 | inline _LIBCPP_INLINE_VISIBILITY |
| 2974 | bool |
| 2975 | atomic_compare_exchange_strong_explicit(volatile atomic_uchar* __obj, |
| 2976 | unsigned char* __exp, |
| 2977 | unsigned char __desr, memory_order __s, |
| 2978 | memory_order __f) |
| 2979 | { |
| 2980 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 2981 | __f); |
| 2982 | } |
| 2983 | |
| 2984 | inline _LIBCPP_INLINE_VISIBILITY |
| 2985 | bool |
| 2986 | atomic_compare_exchange_strong_explicit(atomic_uchar* __obj, |
| 2987 | unsigned char* __exp, |
| 2988 | unsigned char __desr, memory_order __s, |
| 2989 | memory_order __f) |
| 2990 | { |
| 2991 | return atomic_compare_exchange_strong_explicit( |
| 2992 | const_cast<volatile atomic_uchar*>(__obj), __exp, __desr, __s, __f); |
| 2993 | } |
| 2994 | |
| 2995 | inline _LIBCPP_INLINE_VISIBILITY |
| 2996 | unsigned char |
| 2997 | atomic_fetch_add(volatile atomic_uchar* __obj, unsigned char __v) |
| 2998 | { |
| 2999 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 3000 | } |
| 3001 | |
| 3002 | inline _LIBCPP_INLINE_VISIBILITY |
| 3003 | unsigned char |
| 3004 | atomic_fetch_add(atomic_uchar* __obj, unsigned char __v) |
| 3005 | { |
| 3006 | return atomic_fetch_add(const_cast<volatile atomic_uchar*>(__obj), __v); |
| 3007 | } |
| 3008 | |
| 3009 | inline _LIBCPP_INLINE_VISIBILITY |
| 3010 | unsigned char |
| 3011 | atomic_fetch_add_explicit(volatile atomic_uchar* __obj, unsigned char __v, |
| 3012 | memory_order __o) |
| 3013 | { |
| 3014 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 3015 | } |
| 3016 | |
| 3017 | inline _LIBCPP_INLINE_VISIBILITY |
| 3018 | unsigned char |
| 3019 | atomic_fetch_add_explicit(atomic_uchar* __obj, unsigned char __v, |
| 3020 | memory_order __o) |
| 3021 | { |
| 3022 | return atomic_fetch_add_explicit(const_cast<volatile atomic_uchar*>(__obj), |
| 3023 | __v, __o); |
| 3024 | } |
| 3025 | |
| 3026 | inline _LIBCPP_INLINE_VISIBILITY |
| 3027 | unsigned char |
| 3028 | atomic_fetch_sub(volatile atomic_uchar* __obj, unsigned char __v) |
| 3029 | { |
| 3030 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 3031 | } |
| 3032 | |
| 3033 | inline _LIBCPP_INLINE_VISIBILITY |
| 3034 | unsigned char |
| 3035 | atomic_fetch_sub(atomic_uchar* __obj, unsigned char __v) |
| 3036 | { |
| 3037 | return atomic_fetch_sub(const_cast<volatile atomic_uchar*>(__obj), __v); |
| 3038 | } |
| 3039 | |
| 3040 | inline _LIBCPP_INLINE_VISIBILITY |
| 3041 | unsigned char |
| 3042 | atomic_fetch_sub_explicit(volatile atomic_uchar* __obj, unsigned char __v, |
| 3043 | memory_order __o) |
| 3044 | { |
| 3045 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 3046 | } |
| 3047 | |
| 3048 | inline _LIBCPP_INLINE_VISIBILITY |
| 3049 | unsigned char |
| 3050 | atomic_fetch_sub_explicit(atomic_uchar* __obj, unsigned char __v, |
| 3051 | memory_order __o) |
| 3052 | { |
| 3053 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_uchar*>(__obj), |
| 3054 | __v, __o); |
| 3055 | } |
| 3056 | |
| 3057 | inline _LIBCPP_INLINE_VISIBILITY |
| 3058 | unsigned char |
| 3059 | atomic_fetch_and(volatile atomic_uchar* __obj, unsigned char __v) |
| 3060 | { |
| 3061 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 3062 | } |
| 3063 | |
| 3064 | inline _LIBCPP_INLINE_VISIBILITY |
| 3065 | unsigned char |
| 3066 | atomic_fetch_and(atomic_uchar* __obj, unsigned char __v) |
| 3067 | { |
| 3068 | return atomic_fetch_and(const_cast<volatile atomic_uchar*>(__obj), __v); |
| 3069 | } |
| 3070 | |
| 3071 | inline _LIBCPP_INLINE_VISIBILITY |
| 3072 | unsigned char |
| 3073 | atomic_fetch_and_explicit(volatile atomic_uchar* __obj, unsigned char __v, |
| 3074 | memory_order __o) |
| 3075 | { |
| 3076 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 3077 | } |
| 3078 | |
| 3079 | inline _LIBCPP_INLINE_VISIBILITY |
| 3080 | unsigned char |
| 3081 | atomic_fetch_and_explicit(atomic_uchar* __obj, unsigned char __v, |
| 3082 | memory_order __o) |
| 3083 | { |
| 3084 | return atomic_fetch_and_explicit(const_cast<volatile atomic_uchar*>(__obj), |
| 3085 | __v, __o); |
| 3086 | } |
| 3087 | |
| 3088 | inline _LIBCPP_INLINE_VISIBILITY |
| 3089 | unsigned char |
| 3090 | atomic_fetch_or(volatile atomic_uchar* __obj, unsigned char __v) |
| 3091 | { |
| 3092 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 3093 | } |
| 3094 | |
| 3095 | inline _LIBCPP_INLINE_VISIBILITY |
| 3096 | unsigned char |
| 3097 | atomic_fetch_or(atomic_uchar* __obj, unsigned char __v) |
| 3098 | { |
| 3099 | return atomic_fetch_or(const_cast<volatile atomic_uchar*>(__obj), __v); |
| 3100 | } |
| 3101 | |
| 3102 | inline _LIBCPP_INLINE_VISIBILITY |
| 3103 | unsigned char |
| 3104 | atomic_fetch_or_explicit(volatile atomic_uchar* __obj, unsigned char __v, |
| 3105 | memory_order __o) |
| 3106 | { |
| 3107 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 3108 | } |
| 3109 | |
| 3110 | inline _LIBCPP_INLINE_VISIBILITY |
| 3111 | unsigned char |
| 3112 | atomic_fetch_or_explicit(atomic_uchar* __obj, unsigned char __v, |
| 3113 | memory_order __o) |
| 3114 | { |
| 3115 | return atomic_fetch_or_explicit(const_cast<volatile atomic_uchar*>(__obj), |
| 3116 | __v, __o); |
| 3117 | } |
| 3118 | |
| 3119 | inline _LIBCPP_INLINE_VISIBILITY |
| 3120 | unsigned char |
| 3121 | atomic_fetch_xor(volatile atomic_uchar* __obj, unsigned char __v) |
| 3122 | { |
| 3123 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 3124 | } |
| 3125 | |
| 3126 | inline _LIBCPP_INLINE_VISIBILITY |
| 3127 | unsigned char |
| 3128 | atomic_fetch_xor(atomic_uchar* __obj, unsigned char __v) |
| 3129 | { |
| 3130 | return atomic_fetch_xor(const_cast<volatile atomic_uchar*>(__obj), __v); |
| 3131 | } |
| 3132 | |
| 3133 | inline _LIBCPP_INLINE_VISIBILITY |
| 3134 | unsigned char |
| 3135 | atomic_fetch_xor_explicit(volatile atomic_uchar* __obj, unsigned char __v, |
| 3136 | memory_order __o) |
| 3137 | { |
| 3138 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 3139 | } |
| 3140 | |
| 3141 | inline _LIBCPP_INLINE_VISIBILITY |
| 3142 | unsigned char |
| 3143 | atomic_fetch_xor_explicit(atomic_uchar* __obj, unsigned char __v, |
| 3144 | memory_order __o) |
| 3145 | { |
| 3146 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_uchar*>(__obj), |
| 3147 | __v, __o); |
| 3148 | } |
| 3149 | |
| 3150 | // atomic_short |
| 3151 | |
| 3152 | struct atomic_short; |
| 3153 | |
| 3154 | bool atomic_is_lock_free(const volatile atomic_short*); |
| 3155 | bool atomic_is_lock_free(const atomic_short*); |
| 3156 | void atomic_init(volatile atomic_short*, short); |
| 3157 | void atomic_init(atomic_short*, short); |
| 3158 | void atomic_store(volatile atomic_short*, short); |
| 3159 | void atomic_store(atomic_short*, short); |
| 3160 | void atomic_store_explicit(volatile atomic_short*, short, memory_order); |
| 3161 | void atomic_store_explicit(atomic_short*, short, memory_order); |
| 3162 | short atomic_load(const volatile atomic_short*); |
| 3163 | short atomic_load(const atomic_short*); |
| 3164 | short atomic_load_explicit(const volatile atomic_short*, memory_order); |
| 3165 | short atomic_load_explicit(const atomic_short*, memory_order); |
| 3166 | short atomic_exchange(volatile atomic_short*, short); |
| 3167 | short atomic_exchange(atomic_short*, short); |
| 3168 | short atomic_exchange_explicit(volatile atomic_short*, short, memory_order); |
| 3169 | short atomic_exchange_explicit(atomic_short*, short, memory_order); |
| 3170 | bool atomic_compare_exchange_weak(volatile atomic_short*, short*, short); |
| 3171 | bool atomic_compare_exchange_weak(atomic_short*, short*, short); |
| 3172 | bool atomic_compare_exchange_strong(volatile atomic_short*, short*, short); |
| 3173 | bool atomic_compare_exchange_strong(atomic_short*, short*, short); |
| 3174 | bool atomic_compare_exchange_weak_explicit(volatile atomic_short*, short*, |
| 3175 | short, memory_order, memory_order); |
| 3176 | bool atomic_compare_exchange_weak_explicit(atomic_short*, short*, short, |
| 3177 | memory_order, memory_order); |
| 3178 | bool atomic_compare_exchange_strong_explicit(volatile atomic_short*, short*, |
| 3179 | short, memory_order, memory_order); |
| 3180 | bool atomic_compare_exchange_strong_explicit(atomic_short*, short*, short, |
| 3181 | memory_order, memory_order); |
| 3182 | short atomic_fetch_add(volatile atomic_short*, short); |
| 3183 | short atomic_fetch_add(atomic_short*, short); |
| 3184 | short atomic_fetch_add_explicit(volatile atomic_short*, short, memory_order); |
| 3185 | short atomic_fetch_add_explicit(atomic_short*, short, memory_order); |
| 3186 | short atomic_fetch_sub(volatile atomic_short*, short); |
| 3187 | short atomic_fetch_sub(atomic_short*, short); |
| 3188 | short atomic_fetch_sub_explicit(volatile atomic_short*, short, memory_order); |
| 3189 | short atomic_fetch_sub_explicit(atomic_short*, short, memory_order); |
| 3190 | short atomic_fetch_and(volatile atomic_short*, short); |
| 3191 | short atomic_fetch_and(atomic_short*, short); |
| 3192 | short atomic_fetch_and_explicit(volatile atomic_short*, short, memory_order); |
| 3193 | short atomic_fetch_and_explicit(atomic_short*, short, memory_order); |
| 3194 | short atomic_fetch_or(volatile atomic_short*, short); |
| 3195 | short atomic_fetch_or(atomic_short*, short); |
| 3196 | short atomic_fetch_or_explicit(volatile atomic_short*, short, memory_order); |
| 3197 | short atomic_fetch_or_explicit(atomic_short*, short, memory_order); |
| 3198 | short atomic_fetch_xor(volatile atomic_short*, short); |
| 3199 | short atomic_fetch_xor(atomic_short*, short); |
| 3200 | short atomic_fetch_xor_explicit(volatile atomic_short*, short, memory_order); |
| 3201 | short atomic_fetch_xor_explicit(atomic_short*, short, memory_order); |
| 3202 | |
| 3203 | typedef struct atomic_short |
| 3204 | { |
| 3205 | short __v_; |
| 3206 | |
| 3207 | _LIBCPP_INLINE_VISIBILITY |
| 3208 | bool is_lock_free() const volatile |
| 3209 | {return atomic_is_lock_free(this);} |
| 3210 | _LIBCPP_INLINE_VISIBILITY |
| 3211 | bool is_lock_free() const |
| 3212 | {return atomic_is_lock_free(this);} |
| 3213 | _LIBCPP_INLINE_VISIBILITY |
| 3214 | void store(short __v, memory_order __o = memory_order_seq_cst) volatile |
| 3215 | {atomic_store_explicit(this, __v, __o);} |
| 3216 | _LIBCPP_INLINE_VISIBILITY |
| 3217 | void store(short __v, memory_order __o = memory_order_seq_cst) |
| 3218 | {atomic_store_explicit(this, __v, __o);} |
| 3219 | _LIBCPP_INLINE_VISIBILITY |
| 3220 | short load(memory_order __o = memory_order_seq_cst) const volatile |
| 3221 | {return atomic_load_explicit(this, __o);} |
| 3222 | _LIBCPP_INLINE_VISIBILITY |
| 3223 | short load(memory_order __o = memory_order_seq_cst) const |
| 3224 | {return atomic_load_explicit(this, __o);} |
| 3225 | _LIBCPP_INLINE_VISIBILITY |
| 3226 | operator short() const volatile |
| 3227 | {return load();} |
| 3228 | _LIBCPP_INLINE_VISIBILITY |
| 3229 | operator short() const |
| 3230 | {return load();} |
| 3231 | _LIBCPP_INLINE_VISIBILITY |
| 3232 | short exchange(short __v, memory_order __o = memory_order_seq_cst) volatile |
| 3233 | {return atomic_exchange_explicit(this, __v, __o);} |
| 3234 | _LIBCPP_INLINE_VISIBILITY |
| 3235 | short exchange(short __v, memory_order __o = memory_order_seq_cst) |
| 3236 | {return atomic_exchange_explicit(this, __v, __o);} |
| 3237 | _LIBCPP_INLINE_VISIBILITY |
| 3238 | bool compare_exchange_weak(short& __v, short __e, memory_order __s, |
| 3239 | memory_order __f) volatile |
| 3240 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 3241 | __f);} |
| 3242 | _LIBCPP_INLINE_VISIBILITY |
| 3243 | bool compare_exchange_weak(short& __v, short __e, memory_order __s, |
| 3244 | memory_order __f) |
| 3245 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 3246 | __f);} |
| 3247 | _LIBCPP_INLINE_VISIBILITY |
| 3248 | bool compare_exchange_strong(short& __v, short __e, memory_order __s, |
| 3249 | memory_order __f) volatile |
| 3250 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 3251 | __f);} |
| 3252 | _LIBCPP_INLINE_VISIBILITY |
| 3253 | bool compare_exchange_strong(short& __v, short __e, memory_order __s, |
| 3254 | memory_order __f) |
| 3255 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 3256 | __f);} |
| 3257 | _LIBCPP_INLINE_VISIBILITY |
| 3258 | bool compare_exchange_weak(short& __v, short __e, |
| 3259 | memory_order __s = memory_order_seq_cst) volatile |
| 3260 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 3261 | __translate_memory_order(__s));} |
| 3262 | _LIBCPP_INLINE_VISIBILITY |
| 3263 | bool compare_exchange_weak(short& __v, short __e, |
| 3264 | memory_order __s = memory_order_seq_cst) |
| 3265 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 3266 | __translate_memory_order(__s));} |
| 3267 | _LIBCPP_INLINE_VISIBILITY |
| 3268 | bool compare_exchange_strong(short& __v, short __e, |
| 3269 | memory_order __s = memory_order_seq_cst) volatile |
| 3270 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 3271 | __translate_memory_order(__s));} |
| 3272 | _LIBCPP_INLINE_VISIBILITY |
| 3273 | bool compare_exchange_strong(short& __v, short __e, |
| 3274 | memory_order __s = memory_order_seq_cst) |
| 3275 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 3276 | __translate_memory_order(__s));} |
| 3277 | _LIBCPP_INLINE_VISIBILITY |
| 3278 | short fetch_add(short __v, memory_order __o = memory_order_seq_cst) volatile |
| 3279 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 3280 | _LIBCPP_INLINE_VISIBILITY |
| 3281 | short fetch_add(short __v, memory_order __o = memory_order_seq_cst) |
| 3282 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 3283 | _LIBCPP_INLINE_VISIBILITY |
| 3284 | short fetch_sub(short __v, memory_order __o = memory_order_seq_cst) volatile |
| 3285 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 3286 | _LIBCPP_INLINE_VISIBILITY |
| 3287 | short fetch_sub(short __v, memory_order __o = memory_order_seq_cst) |
| 3288 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 3289 | _LIBCPP_INLINE_VISIBILITY |
| 3290 | short fetch_and(short __v, memory_order __o = memory_order_seq_cst) volatile |
| 3291 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 3292 | _LIBCPP_INLINE_VISIBILITY |
| 3293 | short fetch_and(short __v, memory_order __o = memory_order_seq_cst) |
| 3294 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 3295 | _LIBCPP_INLINE_VISIBILITY |
| 3296 | short fetch_or(short __v, memory_order __o = memory_order_seq_cst) volatile |
| 3297 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 3298 | _LIBCPP_INLINE_VISIBILITY |
| 3299 | short fetch_or(short __v, memory_order __o = memory_order_seq_cst) |
| 3300 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 3301 | _LIBCPP_INLINE_VISIBILITY |
| 3302 | short fetch_xor(short __v, memory_order __o = memory_order_seq_cst) volatile |
| 3303 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 3304 | _LIBCPP_INLINE_VISIBILITY |
| 3305 | short fetch_xor(short __v, memory_order __o = memory_order_seq_cst) |
| 3306 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 3307 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 3308 | atomic_short() = default; |
| 3309 | #else |
| 3310 | _LIBCPP_INLINE_VISIBILITY |
| 3311 | atomic_short() {} |
| 3312 | #endif |
| 3313 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 3314 | constexpr atomic_short(short __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 3315 | : __v_(__v) {} |
| 3316 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 3317 | atomic_short(const atomic_short&) = delete; |
| 3318 | atomic_short& operator=(const atomic_short&) = delete; |
| 3319 | atomic_short& operator=(const atomic_short&) volatile = delete; |
| 3320 | #else |
| 3321 | private: |
| 3322 | atomic_short(const atomic_short&); |
| 3323 | atomic_short& operator=(const atomic_short&); |
| 3324 | atomic_short& operator=(const atomic_short&) volatile; |
| 3325 | public: |
| 3326 | #endif |
| 3327 | _LIBCPP_INLINE_VISIBILITY |
| 3328 | short operator=(short __v) volatile |
| 3329 | {store(__v); return __v;} |
| 3330 | _LIBCPP_INLINE_VISIBILITY |
| 3331 | short operator=(short __v) |
| 3332 | {store(__v); return __v;} |
| 3333 | _LIBCPP_INLINE_VISIBILITY |
| 3334 | short operator++(int) volatile |
| 3335 | {return fetch_add(short(1));} |
| 3336 | _LIBCPP_INLINE_VISIBILITY |
| 3337 | short operator++(int) |
| 3338 | {return fetch_add(short(1));} |
| 3339 | _LIBCPP_INLINE_VISIBILITY |
| 3340 | short operator--(int) volatile |
| 3341 | {return fetch_sub(short(1));} |
| 3342 | _LIBCPP_INLINE_VISIBILITY |
| 3343 | short operator--(int) |
| 3344 | {return fetch_sub(short(1));} |
| 3345 | _LIBCPP_INLINE_VISIBILITY |
| 3346 | short operator++() volatile |
| 3347 | {return short(fetch_add(short(1)) + 1);} |
| 3348 | _LIBCPP_INLINE_VISIBILITY |
| 3349 | short operator++() |
| 3350 | {return short(fetch_add(short(1)) + 1);} |
| 3351 | _LIBCPP_INLINE_VISIBILITY |
| 3352 | short operator--() volatile |
| 3353 | {return short(fetch_sub(short(1)) - 1);} |
| 3354 | _LIBCPP_INLINE_VISIBILITY |
| 3355 | short operator--() |
| 3356 | {return short(fetch_sub(short(1)) - 1);} |
| 3357 | _LIBCPP_INLINE_VISIBILITY |
| 3358 | short operator+=(short __v) volatile |
| 3359 | {return short(fetch_add(__v) + __v);} |
| 3360 | _LIBCPP_INLINE_VISIBILITY |
| 3361 | short operator+=(short __v) |
| 3362 | {return short(fetch_add(__v) + __v);} |
| 3363 | _LIBCPP_INLINE_VISIBILITY |
| 3364 | short operator-=(short __v) volatile |
| 3365 | {return short(fetch_sub(__v) - __v);} |
| 3366 | _LIBCPP_INLINE_VISIBILITY |
| 3367 | short operator-=(short __v) |
| 3368 | {return short(fetch_sub(__v) - __v);} |
| 3369 | _LIBCPP_INLINE_VISIBILITY |
| 3370 | short operator&=(short __v) volatile |
| 3371 | {return short(fetch_and(__v) & __v);} |
| 3372 | _LIBCPP_INLINE_VISIBILITY |
| 3373 | short operator&=(short __v) |
| 3374 | {return short(fetch_and(__v) & __v);} |
| 3375 | _LIBCPP_INLINE_VISIBILITY |
| 3376 | short operator|=(short __v) volatile |
| 3377 | {return short(fetch_or(__v) | __v);} |
| 3378 | _LIBCPP_INLINE_VISIBILITY |
| 3379 | short operator|=(short __v) |
| 3380 | {return short(fetch_or(__v) | __v);} |
| 3381 | _LIBCPP_INLINE_VISIBILITY |
| 3382 | short operator^=(short __v) volatile |
| 3383 | {return short(fetch_xor(__v) ^ __v);} |
| 3384 | _LIBCPP_INLINE_VISIBILITY |
| 3385 | short operator^=(short __v) |
| 3386 | {return short(fetch_xor(__v) ^ __v);} |
| 3387 | } atomic_short; |
| 3388 | |
| 3389 | inline _LIBCPP_INLINE_VISIBILITY |
| 3390 | bool |
| 3391 | atomic_is_lock_free(const volatile atomic_short*) |
| 3392 | { |
| 3393 | typedef short type; |
| 3394 | return __atomic_is_lock_free(type); |
| 3395 | } |
| 3396 | |
| 3397 | inline _LIBCPP_INLINE_VISIBILITY |
| 3398 | bool |
| 3399 | atomic_is_lock_free(const atomic_short* __obj) |
| 3400 | { |
| 3401 | return atomic_is_lock_free(const_cast<volatile atomic_short*>(__obj)); |
| 3402 | } |
| 3403 | |
| 3404 | inline _LIBCPP_INLINE_VISIBILITY |
| 3405 | void |
| 3406 | atomic_init(volatile atomic_short* __obj, short __desr) |
| 3407 | { |
| 3408 | __obj->__v_ = __desr; |
| 3409 | } |
| 3410 | |
| 3411 | inline _LIBCPP_INLINE_VISIBILITY |
| 3412 | void |
| 3413 | atomic_init(atomic_short* __obj, short __desr) |
| 3414 | { |
| 3415 | __obj->__v_ = __desr; |
| 3416 | } |
| 3417 | |
| 3418 | inline _LIBCPP_INLINE_VISIBILITY |
| 3419 | void |
| 3420 | atomic_store(volatile atomic_short* __obj, short __desr) |
| 3421 | { |
| 3422 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 3423 | } |
| 3424 | |
| 3425 | inline _LIBCPP_INLINE_VISIBILITY |
| 3426 | void |
| 3427 | atomic_store(atomic_short* __obj, short __desr) |
| 3428 | { |
| 3429 | atomic_store(const_cast<volatile atomic_short*>(__obj), __desr); |
| 3430 | } |
| 3431 | |
| 3432 | inline _LIBCPP_INLINE_VISIBILITY |
| 3433 | void |
| 3434 | atomic_store_explicit(volatile atomic_short* __obj, short __desr, |
| 3435 | memory_order __o) |
| 3436 | { |
| 3437 | __atomic_store(&__obj->__v_, __desr, __o); |
| 3438 | } |
| 3439 | |
| 3440 | inline _LIBCPP_INLINE_VISIBILITY |
| 3441 | void |
| 3442 | atomic_store_explicit(atomic_short* __obj, short __desr, memory_order __o) |
| 3443 | { |
| 3444 | atomic_store_explicit(const_cast<volatile atomic_short*>(__obj), __desr, |
| 3445 | __o); |
| 3446 | } |
| 3447 | |
| 3448 | inline _LIBCPP_INLINE_VISIBILITY |
| 3449 | short |
| 3450 | atomic_load(const volatile atomic_short* __obj) |
| 3451 | { |
| 3452 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 3453 | } |
| 3454 | |
| 3455 | inline _LIBCPP_INLINE_VISIBILITY |
| 3456 | short |
| 3457 | atomic_load(const atomic_short* __obj) |
| 3458 | { |
| 3459 | return atomic_load(const_cast<const volatile atomic_short*>(__obj)); |
| 3460 | } |
| 3461 | |
| 3462 | inline _LIBCPP_INLINE_VISIBILITY |
| 3463 | short |
| 3464 | atomic_load_explicit(const volatile atomic_short* __obj, memory_order __o) |
| 3465 | { |
| 3466 | return __atomic_load(&__obj->__v_, __o); |
| 3467 | } |
| 3468 | |
| 3469 | inline _LIBCPP_INLINE_VISIBILITY |
| 3470 | short |
| 3471 | atomic_load_explicit(const atomic_short* __obj, memory_order __o) |
| 3472 | { |
| 3473 | return atomic_load_explicit(const_cast<const volatile atomic_short*> |
| 3474 | (__obj), __o); |
| 3475 | } |
| 3476 | |
| 3477 | inline _LIBCPP_INLINE_VISIBILITY |
| 3478 | short |
| 3479 | atomic_exchange(volatile atomic_short* __obj, short __desr) |
| 3480 | { |
| 3481 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 3482 | } |
| 3483 | |
| 3484 | inline _LIBCPP_INLINE_VISIBILITY |
| 3485 | short |
| 3486 | atomic_exchange(atomic_short* __obj, short __desr) |
| 3487 | { |
| 3488 | return atomic_exchange(const_cast<volatile atomic_short*>(__obj), __desr); |
| 3489 | } |
| 3490 | |
| 3491 | inline _LIBCPP_INLINE_VISIBILITY |
| 3492 | short |
| 3493 | atomic_exchange_explicit(volatile atomic_short* __obj, short __desr, |
| 3494 | memory_order __o) |
| 3495 | { |
| 3496 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 3497 | } |
| 3498 | |
| 3499 | inline _LIBCPP_INLINE_VISIBILITY |
| 3500 | short |
| 3501 | atomic_exchange_explicit(atomic_short* __obj, short __desr, memory_order __o) |
| 3502 | { |
| 3503 | return atomic_exchange_explicit(const_cast<volatile atomic_short*> |
| 3504 | (__obj), __desr, __o); |
| 3505 | } |
| 3506 | |
| 3507 | inline _LIBCPP_INLINE_VISIBILITY |
| 3508 | bool |
| 3509 | atomic_compare_exchange_weak(volatile atomic_short* __obj, short* __exp, |
| 3510 | short __desr) |
| 3511 | { |
| 3512 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 3513 | memory_order_seq_cst, memory_order_seq_cst); |
| 3514 | } |
| 3515 | |
| 3516 | inline _LIBCPP_INLINE_VISIBILITY |
| 3517 | bool |
| 3518 | atomic_compare_exchange_weak(atomic_short* __obj, short* __exp, short __desr) |
| 3519 | { |
| 3520 | return atomic_compare_exchange_weak(const_cast<volatile atomic_short*> |
| 3521 | (__obj), __exp, __desr); |
| 3522 | } |
| 3523 | |
| 3524 | inline _LIBCPP_INLINE_VISIBILITY |
| 3525 | bool |
| 3526 | atomic_compare_exchange_strong(volatile atomic_short* __obj, short* __exp, |
| 3527 | short __desr) |
| 3528 | { |
| 3529 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 3530 | memory_order_seq_cst, memory_order_seq_cst); |
| 3531 | } |
| 3532 | |
| 3533 | inline _LIBCPP_INLINE_VISIBILITY |
| 3534 | bool |
| 3535 | atomic_compare_exchange_strong(atomic_short* __obj, short* __exp, short __desr) |
| 3536 | { |
| 3537 | return atomic_compare_exchange_strong(const_cast<volatile atomic_short*> |
| 3538 | (__obj), __exp, __desr); |
| 3539 | } |
| 3540 | |
| 3541 | inline _LIBCPP_INLINE_VISIBILITY |
| 3542 | bool |
| 3543 | atomic_compare_exchange_weak_explicit(volatile atomic_short* __obj, |
| 3544 | short* __exp, short __desr, |
| 3545 | memory_order __s, memory_order __f) |
| 3546 | { |
| 3547 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 3548 | __f); |
| 3549 | } |
| 3550 | |
| 3551 | inline _LIBCPP_INLINE_VISIBILITY |
| 3552 | bool |
| 3553 | atomic_compare_exchange_weak_explicit(atomic_short* __obj, short* __exp, |
| 3554 | short __desr, memory_order __s, |
| 3555 | memory_order __f) |
| 3556 | { |
| 3557 | return atomic_compare_exchange_weak_explicit( |
| 3558 | const_cast<volatile atomic_short*>(__obj), __exp, __desr, __s, __f); |
| 3559 | } |
| 3560 | |
| 3561 | inline _LIBCPP_INLINE_VISIBILITY |
| 3562 | bool |
| 3563 | atomic_compare_exchange_strong_explicit(volatile atomic_short* __obj, |
| 3564 | short* __exp, short __desr, |
| 3565 | memory_order __s, memory_order __f) |
| 3566 | { |
| 3567 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 3568 | __f); |
| 3569 | } |
| 3570 | |
| 3571 | inline _LIBCPP_INLINE_VISIBILITY |
| 3572 | bool |
| 3573 | atomic_compare_exchange_strong_explicit(atomic_short* __obj, short* __exp, |
| 3574 | short __desr, memory_order __s, |
| 3575 | memory_order __f) |
| 3576 | { |
| 3577 | return atomic_compare_exchange_strong_explicit( |
| 3578 | const_cast<volatile atomic_short*>(__obj), __exp, __desr, __s, __f); |
| 3579 | } |
| 3580 | |
| 3581 | inline _LIBCPP_INLINE_VISIBILITY |
| 3582 | short |
| 3583 | atomic_fetch_add(volatile atomic_short* __obj, short __v) |
| 3584 | { |
| 3585 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 3586 | } |
| 3587 | |
| 3588 | inline _LIBCPP_INLINE_VISIBILITY |
| 3589 | short |
| 3590 | atomic_fetch_add(atomic_short* __obj, short __v) |
| 3591 | { |
| 3592 | return atomic_fetch_add(const_cast<volatile atomic_short*>(__obj), __v); |
| 3593 | } |
| 3594 | |
| 3595 | inline _LIBCPP_INLINE_VISIBILITY |
| 3596 | short |
| 3597 | atomic_fetch_add_explicit(volatile atomic_short* __obj, short __v, |
| 3598 | memory_order __o) |
| 3599 | { |
| 3600 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 3601 | } |
| 3602 | |
| 3603 | inline _LIBCPP_INLINE_VISIBILITY |
| 3604 | short |
| 3605 | atomic_fetch_add_explicit(atomic_short* __obj, short __v, memory_order __o) |
| 3606 | { |
| 3607 | return atomic_fetch_add_explicit(const_cast<volatile atomic_short*>(__obj), |
| 3608 | __v, __o); |
| 3609 | } |
| 3610 | |
| 3611 | inline _LIBCPP_INLINE_VISIBILITY |
| 3612 | short |
| 3613 | atomic_fetch_sub(volatile atomic_short* __obj, short __v) |
| 3614 | { |
| 3615 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 3616 | } |
| 3617 | |
| 3618 | inline _LIBCPP_INLINE_VISIBILITY |
| 3619 | short |
| 3620 | atomic_fetch_sub(atomic_short* __obj, short __v) |
| 3621 | { |
| 3622 | return atomic_fetch_sub(const_cast<volatile atomic_short*>(__obj), __v); |
| 3623 | } |
| 3624 | |
| 3625 | inline _LIBCPP_INLINE_VISIBILITY |
| 3626 | short |
| 3627 | atomic_fetch_sub_explicit(volatile atomic_short* __obj, short __v, |
| 3628 | memory_order __o) |
| 3629 | { |
| 3630 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 3631 | } |
| 3632 | |
| 3633 | inline _LIBCPP_INLINE_VISIBILITY |
| 3634 | short |
| 3635 | atomic_fetch_sub_explicit(atomic_short* __obj, short __v, memory_order __o) |
| 3636 | { |
| 3637 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_short*>(__obj), |
| 3638 | __v, __o); |
| 3639 | } |
| 3640 | |
| 3641 | inline _LIBCPP_INLINE_VISIBILITY |
| 3642 | short |
| 3643 | atomic_fetch_and(volatile atomic_short* __obj, short __v) |
| 3644 | { |
| 3645 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 3646 | } |
| 3647 | |
| 3648 | inline _LIBCPP_INLINE_VISIBILITY |
| 3649 | short |
| 3650 | atomic_fetch_and(atomic_short* __obj, short __v) |
| 3651 | { |
| 3652 | return atomic_fetch_and(const_cast<volatile atomic_short*>(__obj), __v); |
| 3653 | } |
| 3654 | |
| 3655 | inline _LIBCPP_INLINE_VISIBILITY |
| 3656 | short |
| 3657 | atomic_fetch_and_explicit(volatile atomic_short* __obj, short __v, |
| 3658 | memory_order __o) |
| 3659 | { |
| 3660 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 3661 | } |
| 3662 | |
| 3663 | inline _LIBCPP_INLINE_VISIBILITY |
| 3664 | short |
| 3665 | atomic_fetch_and_explicit(atomic_short* __obj, short __v, memory_order __o) |
| 3666 | { |
| 3667 | return atomic_fetch_and_explicit(const_cast<volatile atomic_short*>(__obj), |
| 3668 | __v, __o); |
| 3669 | } |
| 3670 | |
| 3671 | inline _LIBCPP_INLINE_VISIBILITY |
| 3672 | short |
| 3673 | atomic_fetch_or(volatile atomic_short* __obj, short __v) |
| 3674 | { |
| 3675 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 3676 | } |
| 3677 | |
| 3678 | inline _LIBCPP_INLINE_VISIBILITY |
| 3679 | short |
| 3680 | atomic_fetch_or(atomic_short* __obj, short __v) |
| 3681 | { |
| 3682 | return atomic_fetch_or(const_cast<volatile atomic_short*>(__obj), __v); |
| 3683 | } |
| 3684 | |
| 3685 | inline _LIBCPP_INLINE_VISIBILITY |
| 3686 | short |
| 3687 | atomic_fetch_or_explicit(volatile atomic_short* __obj, short __v, |
| 3688 | memory_order __o) |
| 3689 | { |
| 3690 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 3691 | } |
| 3692 | |
| 3693 | inline _LIBCPP_INLINE_VISIBILITY |
| 3694 | short |
| 3695 | atomic_fetch_or_explicit(atomic_short* __obj, short __v, memory_order __o) |
| 3696 | { |
| 3697 | return atomic_fetch_or_explicit(const_cast<volatile atomic_short*>(__obj), |
| 3698 | __v, __o); |
| 3699 | } |
| 3700 | |
| 3701 | inline _LIBCPP_INLINE_VISIBILITY |
| 3702 | short |
| 3703 | atomic_fetch_xor(volatile atomic_short* __obj, short __v) |
| 3704 | { |
| 3705 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 3706 | } |
| 3707 | |
| 3708 | inline _LIBCPP_INLINE_VISIBILITY |
| 3709 | short |
| 3710 | atomic_fetch_xor(atomic_short* __obj, short __v) |
| 3711 | { |
| 3712 | return atomic_fetch_xor(const_cast<volatile atomic_short*>(__obj), __v); |
| 3713 | } |
| 3714 | |
| 3715 | inline _LIBCPP_INLINE_VISIBILITY |
| 3716 | short |
| 3717 | atomic_fetch_xor_explicit(volatile atomic_short* __obj, short __v, |
| 3718 | memory_order __o) |
| 3719 | { |
| 3720 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 3721 | } |
| 3722 | |
| 3723 | inline _LIBCPP_INLINE_VISIBILITY |
| 3724 | short |
| 3725 | atomic_fetch_xor_explicit(atomic_short* __obj, short __v, memory_order __o) |
| 3726 | { |
| 3727 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_short*>(__obj), |
| 3728 | __v, __o); |
| 3729 | } |
| 3730 | |
| 3731 | // atomic_ushort |
| 3732 | |
| 3733 | struct atomic_ushort; |
| 3734 | |
| 3735 | bool atomic_is_lock_free(const volatile atomic_ushort*); |
| 3736 | bool atomic_is_lock_free(const atomic_ushort*); |
| 3737 | void atomic_init(volatile atomic_ushort*, unsigned short); |
| 3738 | void atomic_init(atomic_ushort*, unsigned short); |
| 3739 | void atomic_store(volatile atomic_ushort*, unsigned short); |
| 3740 | void atomic_store(atomic_ushort*, unsigned short); |
| 3741 | void atomic_store_explicit(volatile atomic_ushort*, unsigned short, |
| 3742 | memory_order); |
| 3743 | void atomic_store_explicit(atomic_ushort*, unsigned short, memory_order); |
| 3744 | unsigned short atomic_load(const volatile atomic_ushort*); |
| 3745 | unsigned short atomic_load(const atomic_ushort*); |
| 3746 | unsigned short atomic_load_explicit(const volatile atomic_ushort*, |
| 3747 | memory_order); |
| 3748 | unsigned short atomic_load_explicit(const atomic_ushort*, memory_order); |
| 3749 | unsigned short atomic_exchange(volatile atomic_ushort*, unsigned short); |
| 3750 | unsigned short atomic_exchange(atomic_ushort*, unsigned short); |
| 3751 | unsigned short atomic_exchange_explicit(volatile atomic_ushort*, unsigned short, |
| 3752 | memory_order); |
| 3753 | unsigned short atomic_exchange_explicit(atomic_ushort*, unsigned short, |
| 3754 | memory_order); |
| 3755 | bool atomic_compare_exchange_weak(volatile atomic_ushort*, unsigned short*, |
| 3756 | unsigned short); |
| 3757 | bool atomic_compare_exchange_weak(atomic_ushort*, unsigned short*, |
| 3758 | unsigned short); |
| 3759 | bool atomic_compare_exchange_strong(volatile atomic_ushort*, unsigned short*, |
| 3760 | unsigned short); |
| 3761 | bool atomic_compare_exchange_strong(atomic_ushort*, unsigned short*, |
| 3762 | unsigned short); |
| 3763 | bool atomic_compare_exchange_weak_explicit(volatile atomic_ushort*, |
| 3764 | unsigned short*, unsigned short, |
| 3765 | memory_order, memory_order); |
| 3766 | bool atomic_compare_exchange_weak_explicit(atomic_ushort*, unsigned short*, |
| 3767 | unsigned short, memory_order, |
| 3768 | memory_order); |
| 3769 | bool atomic_compare_exchange_strong_explicit(volatile atomic_ushort*, |
| 3770 | unsigned short*, unsigned short, |
| 3771 | memory_order, memory_order); |
| 3772 | bool atomic_compare_exchange_strong_explicit(atomic_ushort*, unsigned short*, |
| 3773 | unsigned short, memory_order, |
| 3774 | memory_order); |
| 3775 | unsigned short atomic_fetch_add(volatile atomic_ushort*, unsigned short); |
| 3776 | unsigned short atomic_fetch_add(atomic_ushort*, unsigned short); |
| 3777 | unsigned short atomic_fetch_add_explicit(volatile atomic_ushort*, |
| 3778 | unsigned short, memory_order); |
| 3779 | unsigned short atomic_fetch_add_explicit(atomic_ushort*, unsigned short, |
| 3780 | memory_order); |
| 3781 | unsigned short atomic_fetch_sub(volatile atomic_ushort*, unsigned short); |
| 3782 | unsigned short atomic_fetch_sub(atomic_ushort*, unsigned short); |
| 3783 | unsigned short atomic_fetch_sub_explicit(volatile atomic_ushort*, |
| 3784 | unsigned short, memory_order); |
| 3785 | unsigned short atomic_fetch_sub_explicit(atomic_ushort*, unsigned short, |
| 3786 | memory_order); |
| 3787 | unsigned short atomic_fetch_and(volatile atomic_ushort*, unsigned short); |
| 3788 | unsigned short atomic_fetch_and(atomic_ushort*, unsigned short); |
| 3789 | unsigned short atomic_fetch_and_explicit(volatile atomic_ushort*, |
| 3790 | unsigned short, memory_order); |
| 3791 | unsigned short atomic_fetch_and_explicit(atomic_ushort*, unsigned short, |
| 3792 | memory_order); |
| 3793 | unsigned short atomic_fetch_or(volatile atomic_ushort*, unsigned short); |
| 3794 | unsigned short atomic_fetch_or(atomic_ushort*, unsigned short); |
| 3795 | unsigned short atomic_fetch_or_explicit(volatile atomic_ushort*, unsigned short, |
| 3796 | memory_order); |
| 3797 | unsigned short atomic_fetch_or_explicit(atomic_ushort*, unsigned short, |
| 3798 | memory_order); |
| 3799 | unsigned short atomic_fetch_xor(volatile atomic_ushort*, unsigned short); |
| 3800 | unsigned short atomic_fetch_xor(atomic_ushort*, unsigned short); |
| 3801 | unsigned short atomic_fetch_xor_explicit(volatile atomic_ushort*, |
| 3802 | unsigned short, memory_order); |
| 3803 | unsigned short atomic_fetch_xor_explicit(atomic_ushort*, unsigned short, |
| 3804 | memory_order); |
| 3805 | |
| 3806 | typedef struct atomic_ushort |
| 3807 | { |
| 3808 | unsigned short __v_; |
| 3809 | |
| 3810 | _LIBCPP_INLINE_VISIBILITY |
| 3811 | bool is_lock_free() const volatile |
| 3812 | {return atomic_is_lock_free(this);} |
| 3813 | _LIBCPP_INLINE_VISIBILITY |
| 3814 | bool is_lock_free() const |
| 3815 | {return atomic_is_lock_free(this);} |
| 3816 | _LIBCPP_INLINE_VISIBILITY |
| 3817 | void store(unsigned short __v, |
| 3818 | memory_order __o = memory_order_seq_cst) volatile |
| 3819 | {atomic_store_explicit(this, __v, __o);} |
| 3820 | _LIBCPP_INLINE_VISIBILITY |
| 3821 | void store(unsigned short __v, memory_order __o = memory_order_seq_cst) |
| 3822 | {atomic_store_explicit(this, __v, __o);} |
| 3823 | _LIBCPP_INLINE_VISIBILITY |
| 3824 | unsigned short load(memory_order __o = memory_order_seq_cst) const volatile |
| 3825 | {return atomic_load_explicit(this, __o);} |
| 3826 | _LIBCPP_INLINE_VISIBILITY |
| 3827 | unsigned short load(memory_order __o = memory_order_seq_cst) const |
| 3828 | {return atomic_load_explicit(this, __o);} |
| 3829 | _LIBCPP_INLINE_VISIBILITY |
| 3830 | operator unsigned short() const volatile |
| 3831 | {return load();} |
| 3832 | _LIBCPP_INLINE_VISIBILITY |
| 3833 | operator unsigned short() const |
| 3834 | {return load();} |
| 3835 | _LIBCPP_INLINE_VISIBILITY |
| 3836 | unsigned short exchange(unsigned short __v, |
| 3837 | memory_order __o = memory_order_seq_cst) volatile |
| 3838 | {return atomic_exchange_explicit(this, __v, __o);} |
| 3839 | _LIBCPP_INLINE_VISIBILITY |
| 3840 | unsigned short exchange(unsigned short __v, |
| 3841 | memory_order __o = memory_order_seq_cst) |
| 3842 | {return atomic_exchange_explicit(this, __v, __o);} |
| 3843 | _LIBCPP_INLINE_VISIBILITY |
| 3844 | bool compare_exchange_weak(unsigned short& __v, unsigned short __e, |
| 3845 | memory_order __s, memory_order __f) volatile |
| 3846 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 3847 | __f);} |
| 3848 | _LIBCPP_INLINE_VISIBILITY |
| 3849 | bool compare_exchange_weak(unsigned short& __v, unsigned short __e, |
| 3850 | memory_order __s, memory_order __f) |
| 3851 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 3852 | __f);} |
| 3853 | _LIBCPP_INLINE_VISIBILITY |
| 3854 | bool compare_exchange_strong(unsigned short& __v, unsigned short __e, |
| 3855 | memory_order __s, memory_order __f) volatile |
| 3856 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 3857 | __f);} |
| 3858 | _LIBCPP_INLINE_VISIBILITY |
| 3859 | bool compare_exchange_strong(unsigned short& __v, unsigned short __e, |
| 3860 | memory_order __s, memory_order __f) |
| 3861 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 3862 | __f);} |
| 3863 | _LIBCPP_INLINE_VISIBILITY |
| 3864 | bool compare_exchange_weak(unsigned short& __v, unsigned short __e, |
| 3865 | memory_order __s = memory_order_seq_cst) volatile |
| 3866 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 3867 | __translate_memory_order(__s));} |
| 3868 | _LIBCPP_INLINE_VISIBILITY |
| 3869 | bool compare_exchange_weak(unsigned short& __v, unsigned short __e, |
| 3870 | memory_order __s = memory_order_seq_cst) |
| 3871 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 3872 | __translate_memory_order(__s));} |
| 3873 | _LIBCPP_INLINE_VISIBILITY |
| 3874 | bool compare_exchange_strong(unsigned short& __v, unsigned short __e, |
| 3875 | memory_order __s = memory_order_seq_cst) volatile |
| 3876 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 3877 | __translate_memory_order(__s));} |
| 3878 | _LIBCPP_INLINE_VISIBILITY |
| 3879 | bool compare_exchange_strong(unsigned short& __v, unsigned short __e, |
| 3880 | memory_order __s = memory_order_seq_cst) |
| 3881 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 3882 | __translate_memory_order(__s));} |
| 3883 | _LIBCPP_INLINE_VISIBILITY |
| 3884 | unsigned short fetch_add(unsigned short __v, |
| 3885 | memory_order __o = memory_order_seq_cst) volatile |
| 3886 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 3887 | _LIBCPP_INLINE_VISIBILITY |
| 3888 | unsigned short fetch_add(unsigned short __v, |
| 3889 | memory_order __o = memory_order_seq_cst) |
| 3890 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 3891 | _LIBCPP_INLINE_VISIBILITY |
| 3892 | unsigned short fetch_sub(unsigned short __v, |
| 3893 | memory_order __o = memory_order_seq_cst) volatile |
| 3894 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 3895 | _LIBCPP_INLINE_VISIBILITY |
| 3896 | unsigned short fetch_sub(unsigned short __v, |
| 3897 | memory_order __o = memory_order_seq_cst) |
| 3898 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 3899 | _LIBCPP_INLINE_VISIBILITY |
| 3900 | unsigned short fetch_and(unsigned short __v, |
| 3901 | memory_order __o = memory_order_seq_cst) volatile |
| 3902 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 3903 | _LIBCPP_INLINE_VISIBILITY |
| 3904 | unsigned short fetch_and(unsigned short __v, |
| 3905 | memory_order __o = memory_order_seq_cst) |
| 3906 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 3907 | _LIBCPP_INLINE_VISIBILITY |
| 3908 | unsigned short fetch_or(unsigned short __v, |
| 3909 | memory_order __o = memory_order_seq_cst) volatile |
| 3910 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 3911 | _LIBCPP_INLINE_VISIBILITY |
| 3912 | unsigned short fetch_or(unsigned short __v, |
| 3913 | memory_order __o = memory_order_seq_cst) |
| 3914 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 3915 | _LIBCPP_INLINE_VISIBILITY |
| 3916 | unsigned short fetch_xor(unsigned short __v, |
| 3917 | memory_order __o = memory_order_seq_cst) volatile |
| 3918 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 3919 | _LIBCPP_INLINE_VISIBILITY |
| 3920 | unsigned short fetch_xor(unsigned short __v, |
| 3921 | memory_order __o = memory_order_seq_cst) |
| 3922 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 3923 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 3924 | atomic_ushort() = default; |
| 3925 | #else |
| 3926 | _LIBCPP_INLINE_VISIBILITY |
| 3927 | atomic_ushort() {} |
| 3928 | #endif |
| 3929 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 3930 | constexpr atomic_ushort(unsigned short __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 3931 | : __v_(__v) {} |
| 3932 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 3933 | atomic_ushort(const atomic_ushort&) = delete; |
| 3934 | atomic_ushort& operator=(const atomic_ushort&) = delete; |
| 3935 | atomic_ushort& operator=(const atomic_ushort&) volatile = delete; |
| 3936 | #else |
| 3937 | private: |
| 3938 | atomic_ushort(const atomic_ushort&); |
| 3939 | atomic_ushort& operator=(const atomic_ushort&); |
| 3940 | atomic_ushort& operator=(const atomic_ushort&) volatile; |
| 3941 | public: |
| 3942 | #endif |
| 3943 | _LIBCPP_INLINE_VISIBILITY |
| 3944 | unsigned short operator=(unsigned short __v) volatile |
| 3945 | {store(__v); return __v;} |
| 3946 | _LIBCPP_INLINE_VISIBILITY |
| 3947 | unsigned short operator=(unsigned short __v) |
| 3948 | {store(__v); return __v;} |
| 3949 | _LIBCPP_INLINE_VISIBILITY |
| 3950 | unsigned short operator++(int) volatile |
| 3951 | {typedef unsigned short type; return fetch_add(type(1));} |
| 3952 | _LIBCPP_INLINE_VISIBILITY |
| 3953 | short operator++(int) |
| 3954 | {typedef unsigned short type; return fetch_add(type(1));} |
| 3955 | _LIBCPP_INLINE_VISIBILITY |
| 3956 | short operator--(int) volatile |
| 3957 | {typedef unsigned short type; return fetch_sub(type(1));} |
| 3958 | _LIBCPP_INLINE_VISIBILITY |
| 3959 | short operator--(int) |
| 3960 | {typedef unsigned short type; return fetch_sub(type(1));} |
| 3961 | _LIBCPP_INLINE_VISIBILITY |
| 3962 | short operator++() volatile |
| 3963 | {typedef unsigned short type; return type(fetch_add(type(1)) + 1);} |
| 3964 | _LIBCPP_INLINE_VISIBILITY |
| 3965 | short operator++() |
| 3966 | {typedef unsigned short type; return type(fetch_add(type(1)) + 1);} |
| 3967 | _LIBCPP_INLINE_VISIBILITY |
| 3968 | short operator--() volatile |
| 3969 | {typedef unsigned short type; return type(fetch_sub(type(1)) - 1);} |
| 3970 | _LIBCPP_INLINE_VISIBILITY |
| 3971 | short operator--() |
| 3972 | {typedef unsigned short type; return type(fetch_sub(type(1)) - 1);} |
| 3973 | _LIBCPP_INLINE_VISIBILITY |
| 3974 | short operator+=(short __v) volatile |
| 3975 | {typedef unsigned short type; return type(fetch_add(__v) + __v);} |
| 3976 | _LIBCPP_INLINE_VISIBILITY |
| 3977 | short operator+=(short __v) |
| 3978 | {typedef unsigned short type; return type(fetch_add(__v) + __v);} |
| 3979 | _LIBCPP_INLINE_VISIBILITY |
| 3980 | short operator-=(short __v) volatile |
| 3981 | {typedef unsigned short type; return type(fetch_sub(__v) - __v);} |
| 3982 | _LIBCPP_INLINE_VISIBILITY |
| 3983 | short operator-=(short __v) |
| 3984 | {typedef unsigned short type; return type(fetch_sub(__v) - __v);} |
| 3985 | _LIBCPP_INLINE_VISIBILITY |
| 3986 | short operator&=(short __v) volatile |
| 3987 | {typedef unsigned short type; return type(fetch_and(__v) & __v);} |
| 3988 | _LIBCPP_INLINE_VISIBILITY |
| 3989 | short operator&=(short __v) |
| 3990 | {typedef unsigned short type; return type(fetch_and(__v) & __v);} |
| 3991 | _LIBCPP_INLINE_VISIBILITY |
| 3992 | short operator|=(short __v) volatile |
| 3993 | {typedef unsigned short type; return type(fetch_or(__v) | __v);} |
| 3994 | _LIBCPP_INLINE_VISIBILITY |
| 3995 | short operator|=(short __v) |
| 3996 | {typedef unsigned short type; return type(fetch_or(__v) | __v);} |
| 3997 | _LIBCPP_INLINE_VISIBILITY |
| 3998 | short operator^=(short __v) volatile |
| 3999 | {typedef unsigned short type; return type(fetch_xor(__v) ^ __v);} |
| 4000 | _LIBCPP_INLINE_VISIBILITY |
| 4001 | short operator^=(short __v) |
| 4002 | {typedef unsigned short type; return type(fetch_xor(__v) ^ __v);} |
| 4003 | } atomic_ushort; |
| 4004 | |
| 4005 | inline _LIBCPP_INLINE_VISIBILITY |
| 4006 | bool |
| 4007 | atomic_is_lock_free(const volatile atomic_ushort*) |
| 4008 | { |
| 4009 | typedef unsigned short type; |
| 4010 | return __atomic_is_lock_free(type); |
| 4011 | } |
| 4012 | |
| 4013 | inline _LIBCPP_INLINE_VISIBILITY |
| 4014 | bool |
| 4015 | atomic_is_lock_free(const atomic_ushort* __obj) |
| 4016 | { |
| 4017 | return atomic_is_lock_free(const_cast<volatile atomic_ushort*>(__obj)); |
| 4018 | } |
| 4019 | |
| 4020 | inline _LIBCPP_INLINE_VISIBILITY |
| 4021 | void |
| 4022 | atomic_init(volatile atomic_ushort* __obj, unsigned short __desr) |
| 4023 | { |
| 4024 | __obj->__v_ = __desr; |
| 4025 | } |
| 4026 | |
| 4027 | inline _LIBCPP_INLINE_VISIBILITY |
| 4028 | void |
| 4029 | atomic_init(atomic_ushort* __obj, unsigned short __desr) |
| 4030 | { |
| 4031 | __obj->__v_ = __desr; |
| 4032 | } |
| 4033 | |
| 4034 | inline _LIBCPP_INLINE_VISIBILITY |
| 4035 | void |
| 4036 | atomic_store(volatile atomic_ushort* __obj, unsigned short __desr) |
| 4037 | { |
| 4038 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 4039 | } |
| 4040 | |
| 4041 | inline _LIBCPP_INLINE_VISIBILITY |
| 4042 | void |
| 4043 | atomic_store(atomic_ushort* __obj, unsigned short __desr) |
| 4044 | { |
| 4045 | atomic_store(const_cast<volatile atomic_ushort*>(__obj), __desr); |
| 4046 | } |
| 4047 | |
| 4048 | inline _LIBCPP_INLINE_VISIBILITY |
| 4049 | void |
| 4050 | atomic_store_explicit(volatile atomic_ushort* __obj, unsigned short __desr, |
| 4051 | memory_order __o) |
| 4052 | { |
| 4053 | __atomic_store(&__obj->__v_, __desr, __o); |
| 4054 | } |
| 4055 | |
| 4056 | inline _LIBCPP_INLINE_VISIBILITY |
| 4057 | void |
| 4058 | atomic_store_explicit(atomic_ushort* __obj, unsigned short __desr, |
| 4059 | memory_order __o) |
| 4060 | { |
| 4061 | atomic_store_explicit(const_cast<volatile atomic_ushort*>(__obj), __desr, |
| 4062 | __o); |
| 4063 | } |
| 4064 | |
| 4065 | inline _LIBCPP_INLINE_VISIBILITY |
| 4066 | unsigned short |
| 4067 | atomic_load(const volatile atomic_ushort* __obj) |
| 4068 | { |
| 4069 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 4070 | } |
| 4071 | |
| 4072 | inline _LIBCPP_INLINE_VISIBILITY |
| 4073 | unsigned short |
| 4074 | atomic_load(const atomic_ushort* __obj) |
| 4075 | { |
| 4076 | return atomic_load(const_cast<const volatile atomic_ushort*>(__obj)); |
| 4077 | } |
| 4078 | |
| 4079 | inline _LIBCPP_INLINE_VISIBILITY |
| 4080 | unsigned short |
| 4081 | atomic_load_explicit(const volatile atomic_ushort* __obj, memory_order __o) |
| 4082 | { |
| 4083 | return __atomic_load(&__obj->__v_, __o); |
| 4084 | } |
| 4085 | |
| 4086 | inline _LIBCPP_INLINE_VISIBILITY |
| 4087 | unsigned short |
| 4088 | atomic_load_explicit(const atomic_ushort* __obj, memory_order __o) |
| 4089 | { |
| 4090 | return atomic_load_explicit(const_cast<const volatile atomic_ushort*> |
| 4091 | (__obj), __o); |
| 4092 | } |
| 4093 | |
| 4094 | inline _LIBCPP_INLINE_VISIBILITY |
| 4095 | unsigned short |
| 4096 | atomic_exchange(volatile atomic_ushort* __obj, unsigned short __desr) |
| 4097 | { |
| 4098 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 4099 | } |
| 4100 | |
| 4101 | inline _LIBCPP_INLINE_VISIBILITY |
| 4102 | unsigned short |
| 4103 | atomic_exchange(atomic_ushort* __obj, unsigned short __desr) |
| 4104 | { |
| 4105 | return atomic_exchange(const_cast<volatile atomic_ushort*>(__obj), __desr); |
| 4106 | } |
| 4107 | |
| 4108 | inline _LIBCPP_INLINE_VISIBILITY |
| 4109 | unsigned short |
| 4110 | atomic_exchange_explicit(volatile atomic_ushort* __obj, unsigned short __desr, |
| 4111 | memory_order __o) |
| 4112 | { |
| 4113 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 4114 | } |
| 4115 | |
| 4116 | inline _LIBCPP_INLINE_VISIBILITY |
| 4117 | unsigned short |
| 4118 | atomic_exchange_explicit(atomic_ushort* __obj, unsigned short __desr, |
| 4119 | memory_order __o) |
| 4120 | { |
| 4121 | return atomic_exchange_explicit(const_cast<volatile atomic_ushort*> |
| 4122 | (__obj), __desr, __o); |
| 4123 | } |
| 4124 | |
| 4125 | inline _LIBCPP_INLINE_VISIBILITY |
| 4126 | bool |
| 4127 | atomic_compare_exchange_weak(volatile atomic_ushort* __obj, |
| 4128 | unsigned short* __exp, unsigned short __desr) |
| 4129 | { |
| 4130 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 4131 | memory_order_seq_cst, memory_order_seq_cst); |
| 4132 | } |
| 4133 | |
| 4134 | inline _LIBCPP_INLINE_VISIBILITY |
| 4135 | bool |
| 4136 | atomic_compare_exchange_weak(atomic_ushort* __obj, unsigned short* __exp, |
| 4137 | unsigned short __desr) |
| 4138 | { |
| 4139 | return atomic_compare_exchange_weak(const_cast<volatile atomic_ushort*> |
| 4140 | (__obj), __exp, __desr); |
| 4141 | } |
| 4142 | |
| 4143 | inline _LIBCPP_INLINE_VISIBILITY |
| 4144 | bool |
| 4145 | atomic_compare_exchange_strong(volatile atomic_ushort* __obj, |
| 4146 | unsigned short* __exp, unsigned short __desr) |
| 4147 | { |
| 4148 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 4149 | memory_order_seq_cst, memory_order_seq_cst); |
| 4150 | } |
| 4151 | |
| 4152 | inline _LIBCPP_INLINE_VISIBILITY |
| 4153 | bool |
| 4154 | atomic_compare_exchange_strong(atomic_ushort* __obj, unsigned short* __exp, |
| 4155 | unsigned short __desr) |
| 4156 | { |
| 4157 | return atomic_compare_exchange_strong(const_cast<volatile atomic_ushort*> |
| 4158 | (__obj), __exp, __desr); |
| 4159 | } |
| 4160 | |
| 4161 | inline _LIBCPP_INLINE_VISIBILITY |
| 4162 | bool |
| 4163 | atomic_compare_exchange_weak_explicit(volatile atomic_ushort* __obj, |
| 4164 | unsigned short* __exp, |
| 4165 | unsigned short __desr, memory_order __s, |
| 4166 | memory_order __f) |
| 4167 | { |
| 4168 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 4169 | __f); |
| 4170 | } |
| 4171 | |
| 4172 | inline _LIBCPP_INLINE_VISIBILITY |
| 4173 | bool |
| 4174 | atomic_compare_exchange_weak_explicit(atomic_ushort* __obj, |
| 4175 | unsigned short* __exp, |
| 4176 | unsigned short __desr, memory_order __s, |
| 4177 | memory_order __f) |
| 4178 | { |
| 4179 | return atomic_compare_exchange_weak_explicit( |
| 4180 | const_cast<volatile atomic_ushort*>(__obj), __exp, __desr, __s, __f); |
| 4181 | } |
| 4182 | |
| 4183 | inline _LIBCPP_INLINE_VISIBILITY |
| 4184 | bool |
| 4185 | atomic_compare_exchange_strong_explicit(volatile atomic_ushort* __obj, |
| 4186 | unsigned short* __exp, |
| 4187 | unsigned short __desr, memory_order __s, |
| 4188 | memory_order __f) |
| 4189 | { |
| 4190 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 4191 | __f); |
| 4192 | } |
| 4193 | |
| 4194 | inline _LIBCPP_INLINE_VISIBILITY |
| 4195 | bool |
| 4196 | atomic_compare_exchange_strong_explicit(atomic_ushort* __obj, |
| 4197 | unsigned short* __exp, |
| 4198 | unsigned short __desr, memory_order __s, |
| 4199 | memory_order __f) |
| 4200 | { |
| 4201 | return atomic_compare_exchange_strong_explicit( |
| 4202 | const_cast<volatile atomic_ushort*>(__obj), __exp, __desr, __s, __f); |
| 4203 | } |
| 4204 | |
| 4205 | inline _LIBCPP_INLINE_VISIBILITY |
| 4206 | unsigned short |
| 4207 | atomic_fetch_add(volatile atomic_ushort* __obj, unsigned short __v) |
| 4208 | { |
| 4209 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 4210 | } |
| 4211 | |
| 4212 | inline _LIBCPP_INLINE_VISIBILITY |
| 4213 | unsigned short |
| 4214 | atomic_fetch_add(atomic_ushort* __obj, unsigned short __v) |
| 4215 | { |
| 4216 | return atomic_fetch_add(const_cast<volatile atomic_ushort*>(__obj), __v); |
| 4217 | } |
| 4218 | |
| 4219 | inline _LIBCPP_INLINE_VISIBILITY |
| 4220 | unsigned short |
| 4221 | atomic_fetch_add_explicit(volatile atomic_ushort* __obj, unsigned short __v, |
| 4222 | memory_order __o) |
| 4223 | { |
| 4224 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 4225 | } |
| 4226 | |
| 4227 | inline _LIBCPP_INLINE_VISIBILITY |
| 4228 | unsigned short |
| 4229 | atomic_fetch_add_explicit(atomic_ushort* __obj, unsigned short __v, |
| 4230 | memory_order __o) |
| 4231 | { |
| 4232 | return atomic_fetch_add_explicit(const_cast<volatile atomic_ushort*>(__obj), |
| 4233 | __v, __o); |
| 4234 | } |
| 4235 | |
| 4236 | inline _LIBCPP_INLINE_VISIBILITY |
| 4237 | unsigned short |
| 4238 | atomic_fetch_sub(volatile atomic_ushort* __obj, unsigned short __v) |
| 4239 | { |
| 4240 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 4241 | } |
| 4242 | |
| 4243 | inline _LIBCPP_INLINE_VISIBILITY |
| 4244 | unsigned short |
| 4245 | atomic_fetch_sub(atomic_ushort* __obj, unsigned short __v) |
| 4246 | { |
| 4247 | return atomic_fetch_sub(const_cast<volatile atomic_ushort*>(__obj), __v); |
| 4248 | } |
| 4249 | |
| 4250 | inline _LIBCPP_INLINE_VISIBILITY |
| 4251 | unsigned short |
| 4252 | atomic_fetch_sub_explicit(volatile atomic_ushort* __obj, unsigned short __v, |
| 4253 | memory_order __o) |
| 4254 | { |
| 4255 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 4256 | } |
| 4257 | |
| 4258 | inline _LIBCPP_INLINE_VISIBILITY |
| 4259 | unsigned short |
| 4260 | atomic_fetch_sub_explicit(atomic_ushort* __obj, unsigned short __v, |
| 4261 | memory_order __o) |
| 4262 | { |
| 4263 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_ushort*>(__obj), |
| 4264 | __v, __o); |
| 4265 | } |
| 4266 | |
| 4267 | inline _LIBCPP_INLINE_VISIBILITY |
| 4268 | unsigned short |
| 4269 | atomic_fetch_and(volatile atomic_ushort* __obj, unsigned short __v) |
| 4270 | { |
| 4271 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 4272 | } |
| 4273 | |
| 4274 | inline _LIBCPP_INLINE_VISIBILITY |
| 4275 | unsigned short |
| 4276 | atomic_fetch_and(atomic_ushort* __obj, unsigned short __v) |
| 4277 | { |
| 4278 | return atomic_fetch_and(const_cast<volatile atomic_ushort*>(__obj), __v); |
| 4279 | } |
| 4280 | |
| 4281 | inline _LIBCPP_INLINE_VISIBILITY |
| 4282 | unsigned short |
| 4283 | atomic_fetch_and_explicit(volatile atomic_ushort* __obj, unsigned short __v, |
| 4284 | memory_order __o) |
| 4285 | { |
| 4286 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 4287 | } |
| 4288 | |
| 4289 | inline _LIBCPP_INLINE_VISIBILITY |
| 4290 | unsigned short |
| 4291 | atomic_fetch_and_explicit(atomic_ushort* __obj, unsigned short __v, |
| 4292 | memory_order __o) |
| 4293 | { |
| 4294 | return atomic_fetch_and_explicit(const_cast<volatile atomic_ushort*>(__obj), |
| 4295 | __v, __o); |
| 4296 | } |
| 4297 | |
| 4298 | inline _LIBCPP_INLINE_VISIBILITY |
| 4299 | unsigned short |
| 4300 | atomic_fetch_or(volatile atomic_ushort* __obj, unsigned short __v) |
| 4301 | { |
| 4302 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 4303 | } |
| 4304 | |
| 4305 | inline _LIBCPP_INLINE_VISIBILITY |
| 4306 | unsigned short |
| 4307 | atomic_fetch_or(atomic_ushort* __obj, unsigned short __v) |
| 4308 | { |
| 4309 | return atomic_fetch_or(const_cast<volatile atomic_ushort*>(__obj), __v); |
| 4310 | } |
| 4311 | |
| 4312 | inline _LIBCPP_INLINE_VISIBILITY |
| 4313 | unsigned short |
| 4314 | atomic_fetch_or_explicit(volatile atomic_ushort* __obj, unsigned short __v, |
| 4315 | memory_order __o) |
| 4316 | { |
| 4317 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 4318 | } |
| 4319 | |
| 4320 | inline _LIBCPP_INLINE_VISIBILITY |
| 4321 | unsigned short |
| 4322 | atomic_fetch_or_explicit(atomic_ushort* __obj, unsigned short __v, |
| 4323 | memory_order __o) |
| 4324 | { |
| 4325 | return atomic_fetch_or_explicit(const_cast<volatile atomic_ushort*>(__obj), |
| 4326 | __v, __o); |
| 4327 | } |
| 4328 | |
| 4329 | inline _LIBCPP_INLINE_VISIBILITY |
| 4330 | unsigned short |
| 4331 | atomic_fetch_xor(volatile atomic_ushort* __obj, unsigned short __v) |
| 4332 | { |
| 4333 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 4334 | } |
| 4335 | |
| 4336 | inline _LIBCPP_INLINE_VISIBILITY |
| 4337 | unsigned short |
| 4338 | atomic_fetch_xor(atomic_ushort* __obj, unsigned short __v) |
| 4339 | { |
| 4340 | return atomic_fetch_xor(const_cast<volatile atomic_ushort*>(__obj), __v); |
| 4341 | } |
| 4342 | |
| 4343 | inline _LIBCPP_INLINE_VISIBILITY |
| 4344 | unsigned short |
| 4345 | atomic_fetch_xor_explicit(volatile atomic_ushort* __obj, unsigned short __v, |
| 4346 | memory_order __o) |
| 4347 | { |
| 4348 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 4349 | } |
| 4350 | |
| 4351 | inline _LIBCPP_INLINE_VISIBILITY |
| 4352 | unsigned short |
| 4353 | atomic_fetch_xor_explicit(atomic_ushort* __obj, unsigned short __v, |
| 4354 | memory_order __o) |
| 4355 | { |
| 4356 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_ushort*>(__obj), |
| 4357 | __v, __o); |
| 4358 | } |
| 4359 | |
| 4360 | // atomic_int |
| 4361 | |
| 4362 | struct atomic_int; |
| 4363 | |
| 4364 | bool atomic_is_lock_free(const volatile atomic_int*); |
| 4365 | bool atomic_is_lock_free(const atomic_int*); |
| 4366 | void atomic_init(volatile atomic_int*, int); |
| 4367 | void atomic_init(atomic_int*, int); |
| 4368 | void atomic_store(volatile atomic_int*, int); |
| 4369 | void atomic_store(atomic_int*, int); |
| 4370 | void atomic_store_explicit(volatile atomic_int*, int, memory_order); |
| 4371 | void atomic_store_explicit(atomic_int*, int, memory_order); |
| 4372 | int atomic_load(const volatile atomic_int*); |
| 4373 | int atomic_load(const atomic_int*); |
| 4374 | int atomic_load_explicit(const volatile atomic_int*, memory_order); |
| 4375 | int atomic_load_explicit(const atomic_int*, memory_order); |
| 4376 | int atomic_exchange(volatile atomic_int*, int); |
| 4377 | int atomic_exchange(atomic_int*, int); |
| 4378 | int atomic_exchange_explicit(volatile atomic_int*, int, memory_order); |
| 4379 | int atomic_exchange_explicit(atomic_int*, int, memory_order); |
| 4380 | bool atomic_compare_exchange_weak(volatile atomic_int*, int*, int); |
| 4381 | bool atomic_compare_exchange_weak(atomic_int*, int*, int); |
| 4382 | bool atomic_compare_exchange_strong(volatile atomic_int*, int*, int); |
| 4383 | bool atomic_compare_exchange_strong(atomic_int*, int*, int); |
| 4384 | bool atomic_compare_exchange_weak_explicit(volatile atomic_int*, int*, int, |
| 4385 | memory_order, memory_order); |
| 4386 | bool atomic_compare_exchange_weak_explicit(atomic_int*, int*, int, |
| 4387 | memory_order, memory_order); |
| 4388 | bool atomic_compare_exchange_strong_explicit(volatile atomic_int*, int*, int, |
| 4389 | memory_order, memory_order); |
| 4390 | bool atomic_compare_exchange_strong_explicit(atomic_int*, int*, int, |
| 4391 | memory_order, memory_order); |
| 4392 | int atomic_fetch_add(volatile atomic_int*, int); |
| 4393 | int atomic_fetch_add(atomic_int*, int); |
| 4394 | int atomic_fetch_add_explicit(volatile atomic_int*, int, memory_order); |
| 4395 | int atomic_fetch_add_explicit(atomic_int*, int, memory_order); |
| 4396 | int atomic_fetch_sub(volatile atomic_int*, int); |
| 4397 | int atomic_fetch_sub(atomic_int*, int); |
| 4398 | int atomic_fetch_sub_explicit(volatile atomic_int*, int, memory_order); |
| 4399 | int atomic_fetch_sub_explicit(atomic_int*, int, memory_order); |
| 4400 | int atomic_fetch_and(volatile atomic_int*, int); |
| 4401 | int atomic_fetch_and(atomic_int*, int); |
| 4402 | int atomic_fetch_and_explicit(volatile atomic_int*, int, memory_order); |
| 4403 | int atomic_fetch_and_explicit(atomic_int*, int, memory_order); |
| 4404 | int atomic_fetch_or(volatile atomic_int*, int); |
| 4405 | int atomic_fetch_or(atomic_int*, int); |
| 4406 | int atomic_fetch_or_explicit(volatile atomic_int*, int, memory_order); |
| 4407 | int atomic_fetch_or_explicit(atomic_int*, int, memory_order); |
| 4408 | int atomic_fetch_xor(volatile atomic_int*, int); |
| 4409 | int atomic_fetch_xor(atomic_int*, int); |
| 4410 | int atomic_fetch_xor_explicit(volatile atomic_int*, int, memory_order); |
| 4411 | int atomic_fetch_xor_explicit(atomic_int*, int, memory_order); |
| 4412 | |
| 4413 | typedef struct atomic_int |
| 4414 | { |
| 4415 | int __v_; |
| 4416 | |
| 4417 | _LIBCPP_INLINE_VISIBILITY |
| 4418 | bool is_lock_free() const volatile |
| 4419 | {return atomic_is_lock_free(this);} |
| 4420 | _LIBCPP_INLINE_VISIBILITY |
| 4421 | bool is_lock_free() const |
| 4422 | {return atomic_is_lock_free(this);} |
| 4423 | _LIBCPP_INLINE_VISIBILITY |
| 4424 | void store(int __v, memory_order __o = memory_order_seq_cst) volatile |
| 4425 | {atomic_store_explicit(this, __v, __o);} |
| 4426 | _LIBCPP_INLINE_VISIBILITY |
| 4427 | void store(int __v, memory_order __o = memory_order_seq_cst) |
| 4428 | {atomic_store_explicit(this, __v, __o);} |
| 4429 | _LIBCPP_INLINE_VISIBILITY |
| 4430 | int load(memory_order __o = memory_order_seq_cst) const volatile |
| 4431 | {return atomic_load_explicit(this, __o);} |
| 4432 | _LIBCPP_INLINE_VISIBILITY |
| 4433 | int load(memory_order __o = memory_order_seq_cst) const |
| 4434 | {return atomic_load_explicit(this, __o);} |
| 4435 | _LIBCPP_INLINE_VISIBILITY |
| 4436 | operator int() const volatile |
| 4437 | {return load();} |
| 4438 | _LIBCPP_INLINE_VISIBILITY |
| 4439 | operator int() const |
| 4440 | {return load();} |
| 4441 | _LIBCPP_INLINE_VISIBILITY |
| 4442 | int exchange(int __v, memory_order __o = memory_order_seq_cst) volatile |
| 4443 | {return atomic_exchange_explicit(this, __v, __o);} |
| 4444 | _LIBCPP_INLINE_VISIBILITY |
| 4445 | int exchange(int __v, memory_order __o = memory_order_seq_cst) |
| 4446 | {return atomic_exchange_explicit(this, __v, __o);} |
| 4447 | _LIBCPP_INLINE_VISIBILITY |
| 4448 | bool compare_exchange_weak(int& __v, int __e, memory_order __s, |
| 4449 | memory_order __f) volatile |
| 4450 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 4451 | __f);} |
| 4452 | _LIBCPP_INLINE_VISIBILITY |
| 4453 | bool compare_exchange_weak(int& __v, int __e, memory_order __s, |
| 4454 | memory_order __f) |
| 4455 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 4456 | __f);} |
| 4457 | _LIBCPP_INLINE_VISIBILITY |
| 4458 | bool compare_exchange_strong(int& __v, int __e, memory_order __s, |
| 4459 | memory_order __f) volatile |
| 4460 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 4461 | __f);} |
| 4462 | _LIBCPP_INLINE_VISIBILITY |
| 4463 | bool compare_exchange_strong(int& __v, int __e, memory_order __s, |
| 4464 | memory_order __f) |
| 4465 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 4466 | __f);} |
| 4467 | _LIBCPP_INLINE_VISIBILITY |
| 4468 | bool compare_exchange_weak(int& __v, int __e, |
| 4469 | memory_order __s = memory_order_seq_cst) volatile |
| 4470 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 4471 | __translate_memory_order(__s));} |
| 4472 | _LIBCPP_INLINE_VISIBILITY |
| 4473 | bool compare_exchange_weak(int& __v, int __e, |
| 4474 | memory_order __s = memory_order_seq_cst) |
| 4475 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 4476 | __translate_memory_order(__s));} |
| 4477 | _LIBCPP_INLINE_VISIBILITY |
| 4478 | bool compare_exchange_strong(int& __v, int __e, |
| 4479 | memory_order __s = memory_order_seq_cst) volatile |
| 4480 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 4481 | __translate_memory_order(__s));} |
| 4482 | _LIBCPP_INLINE_VISIBILITY |
| 4483 | bool compare_exchange_strong(int& __v, int __e, |
| 4484 | memory_order __s = memory_order_seq_cst) |
| 4485 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 4486 | __translate_memory_order(__s));} |
| 4487 | _LIBCPP_INLINE_VISIBILITY |
| 4488 | int fetch_add(int __v, memory_order __o = memory_order_seq_cst) volatile |
| 4489 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 4490 | _LIBCPP_INLINE_VISIBILITY |
| 4491 | int fetch_add(int __v, memory_order __o = memory_order_seq_cst) |
| 4492 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 4493 | _LIBCPP_INLINE_VISIBILITY |
| 4494 | int fetch_sub(int __v, memory_order __o = memory_order_seq_cst) volatile |
| 4495 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 4496 | _LIBCPP_INLINE_VISIBILITY |
| 4497 | int fetch_sub(int __v, memory_order __o = memory_order_seq_cst) |
| 4498 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 4499 | _LIBCPP_INLINE_VISIBILITY |
| 4500 | int fetch_and(int __v, memory_order __o = memory_order_seq_cst) volatile |
| 4501 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 4502 | _LIBCPP_INLINE_VISIBILITY |
| 4503 | int fetch_and(int __v, memory_order __o = memory_order_seq_cst) |
| 4504 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 4505 | _LIBCPP_INLINE_VISIBILITY |
| 4506 | int fetch_or(int __v, memory_order __o = memory_order_seq_cst) volatile |
| 4507 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 4508 | _LIBCPP_INLINE_VISIBILITY |
| 4509 | int fetch_or(int __v, memory_order __o = memory_order_seq_cst) |
| 4510 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 4511 | _LIBCPP_INLINE_VISIBILITY |
| 4512 | int fetch_xor(int __v, memory_order __o = memory_order_seq_cst) volatile |
| 4513 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 4514 | _LIBCPP_INLINE_VISIBILITY |
| 4515 | int fetch_xor(int __v, memory_order __o = memory_order_seq_cst) |
| 4516 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 4517 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 4518 | atomic_int() = default; |
| 4519 | #else |
| 4520 | _LIBCPP_INLINE_VISIBILITY |
| 4521 | atomic_int() {} |
| 4522 | #endif |
| 4523 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 4524 | constexpr atomic_int(int __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 4525 | : __v_(__v) {} |
| 4526 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 4527 | atomic_int(const atomic_int&) = delete; |
| 4528 | atomic_int& operator=(const atomic_int&) = delete; |
| 4529 | atomic_int& operator=(const atomic_int&) volatile = delete; |
| 4530 | #else |
| 4531 | private: |
| 4532 | atomic_int(const atomic_int&); |
| 4533 | atomic_int& operator=(const atomic_int&); |
| 4534 | atomic_int& operator=(const atomic_int&) volatile; |
| 4535 | public: |
| 4536 | #endif |
| 4537 | _LIBCPP_INLINE_VISIBILITY |
| 4538 | int operator=(int __v) volatile |
| 4539 | {store(__v); return __v;} |
| 4540 | _LIBCPP_INLINE_VISIBILITY |
| 4541 | int operator=(int __v) |
| 4542 | {store(__v); return __v;} |
| 4543 | _LIBCPP_INLINE_VISIBILITY |
| 4544 | int operator++(int) volatile |
| 4545 | {return fetch_add(int(1));} |
| 4546 | _LIBCPP_INLINE_VISIBILITY |
| 4547 | int operator++(int) |
| 4548 | {return fetch_add(int(1));} |
| 4549 | _LIBCPP_INLINE_VISIBILITY |
| 4550 | int operator--(int) volatile |
| 4551 | {return fetch_sub(int(1));} |
| 4552 | _LIBCPP_INLINE_VISIBILITY |
| 4553 | int operator--(int) |
| 4554 | {return fetch_sub(int(1));} |
| 4555 | _LIBCPP_INLINE_VISIBILITY |
| 4556 | int operator++() volatile |
| 4557 | {return int(fetch_add(int(1)) + 1);} |
| 4558 | _LIBCPP_INLINE_VISIBILITY |
| 4559 | int operator++() |
| 4560 | {return int(fetch_add(int(1)) + 1);} |
| 4561 | _LIBCPP_INLINE_VISIBILITY |
| 4562 | int operator--() volatile |
| 4563 | {return int(fetch_sub(int(1)) - 1);} |
| 4564 | _LIBCPP_INLINE_VISIBILITY |
| 4565 | int operator--() |
| 4566 | {return int(fetch_sub(int(1)) - 1);} |
| 4567 | _LIBCPP_INLINE_VISIBILITY |
| 4568 | int operator+=(int __v) volatile |
| 4569 | {return int(fetch_add(__v) + __v);} |
| 4570 | _LIBCPP_INLINE_VISIBILITY |
| 4571 | int operator+=(int __v) |
| 4572 | {return int(fetch_add(__v) + __v);} |
| 4573 | _LIBCPP_INLINE_VISIBILITY |
| 4574 | int operator-=(int __v) volatile |
| 4575 | {return int(fetch_sub(__v) - __v);} |
| 4576 | _LIBCPP_INLINE_VISIBILITY |
| 4577 | int operator-=(int __v) |
| 4578 | {return int(fetch_sub(__v) - __v);} |
| 4579 | _LIBCPP_INLINE_VISIBILITY |
| 4580 | int operator&=(int __v) volatile |
| 4581 | {return int(fetch_and(__v) & __v);} |
| 4582 | _LIBCPP_INLINE_VISIBILITY |
| 4583 | int operator&=(int __v) |
| 4584 | {return int(fetch_and(__v) & __v);} |
| 4585 | _LIBCPP_INLINE_VISIBILITY |
| 4586 | int operator|=(int __v) volatile |
| 4587 | {return int(fetch_or(__v) | __v);} |
| 4588 | _LIBCPP_INLINE_VISIBILITY |
| 4589 | int operator|=(int __v) |
| 4590 | {return int(fetch_or(__v) | __v);} |
| 4591 | _LIBCPP_INLINE_VISIBILITY |
| 4592 | int operator^=(int __v) volatile |
| 4593 | {return int(fetch_xor(__v) ^ __v);} |
| 4594 | _LIBCPP_INLINE_VISIBILITY |
| 4595 | int operator^=(int __v) |
| 4596 | {return int(fetch_xor(__v) ^ __v);} |
| 4597 | } atomic_int; |
| 4598 | |
| 4599 | inline _LIBCPP_INLINE_VISIBILITY |
| 4600 | bool |
| 4601 | atomic_is_lock_free(const volatile atomic_int*) |
| 4602 | { |
| 4603 | typedef int type; |
| 4604 | return __atomic_is_lock_free(type); |
| 4605 | } |
| 4606 | |
| 4607 | inline _LIBCPP_INLINE_VISIBILITY |
| 4608 | bool |
| 4609 | atomic_is_lock_free(const atomic_int* __obj) |
| 4610 | { |
| 4611 | return atomic_is_lock_free(const_cast<volatile atomic_int*>(__obj)); |
| 4612 | } |
| 4613 | |
| 4614 | inline _LIBCPP_INLINE_VISIBILITY |
| 4615 | void |
| 4616 | atomic_init(volatile atomic_int* __obj, int __desr) |
| 4617 | { |
| 4618 | __obj->__v_ = __desr; |
| 4619 | } |
| 4620 | |
| 4621 | inline _LIBCPP_INLINE_VISIBILITY |
| 4622 | void |
| 4623 | atomic_init(atomic_int* __obj, int __desr) |
| 4624 | { |
| 4625 | __obj->__v_ = __desr; |
| 4626 | } |
| 4627 | |
| 4628 | inline _LIBCPP_INLINE_VISIBILITY |
| 4629 | void |
| 4630 | atomic_store(volatile atomic_int* __obj, int __desr) |
| 4631 | { |
| 4632 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 4633 | } |
| 4634 | |
| 4635 | inline _LIBCPP_INLINE_VISIBILITY |
| 4636 | void |
| 4637 | atomic_store(atomic_int* __obj, int __desr) |
| 4638 | { |
| 4639 | atomic_store(const_cast<volatile atomic_int*>(__obj), __desr); |
| 4640 | } |
| 4641 | |
| 4642 | inline _LIBCPP_INLINE_VISIBILITY |
| 4643 | void |
| 4644 | atomic_store_explicit(volatile atomic_int* __obj, int __desr, |
| 4645 | memory_order __o) |
| 4646 | { |
| 4647 | __atomic_store(&__obj->__v_, __desr, __o); |
| 4648 | } |
| 4649 | |
| 4650 | inline _LIBCPP_INLINE_VISIBILITY |
| 4651 | void |
| 4652 | atomic_store_explicit(atomic_int* __obj, int __desr, memory_order __o) |
| 4653 | { |
| 4654 | atomic_store_explicit(const_cast<volatile atomic_int*>(__obj), __desr, |
| 4655 | __o); |
| 4656 | } |
| 4657 | |
| 4658 | inline _LIBCPP_INLINE_VISIBILITY |
| 4659 | int |
| 4660 | atomic_load(const volatile atomic_int* __obj) |
| 4661 | { |
| 4662 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 4663 | } |
| 4664 | |
| 4665 | inline _LIBCPP_INLINE_VISIBILITY |
| 4666 | int |
| 4667 | atomic_load(const atomic_int* __obj) |
| 4668 | { |
| 4669 | return atomic_load(const_cast<const volatile atomic_int*>(__obj)); |
| 4670 | } |
| 4671 | |
| 4672 | inline _LIBCPP_INLINE_VISIBILITY |
| 4673 | int |
| 4674 | atomic_load_explicit(const volatile atomic_int* __obj, memory_order __o) |
| 4675 | { |
| 4676 | return __atomic_load(&__obj->__v_, __o); |
| 4677 | } |
| 4678 | |
| 4679 | inline _LIBCPP_INLINE_VISIBILITY |
| 4680 | int |
| 4681 | atomic_load_explicit(const atomic_int* __obj, memory_order __o) |
| 4682 | { |
| 4683 | return atomic_load_explicit(const_cast<const volatile atomic_int*> |
| 4684 | (__obj), __o); |
| 4685 | } |
| 4686 | |
| 4687 | inline _LIBCPP_INLINE_VISIBILITY |
| 4688 | int |
| 4689 | atomic_exchange(volatile atomic_int* __obj, int __desr) |
| 4690 | { |
| 4691 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 4692 | } |
| 4693 | |
| 4694 | inline _LIBCPP_INLINE_VISIBILITY |
| 4695 | int |
| 4696 | atomic_exchange(atomic_int* __obj, int __desr) |
| 4697 | { |
| 4698 | return atomic_exchange(const_cast<volatile atomic_int*>(__obj), __desr); |
| 4699 | } |
| 4700 | |
| 4701 | inline _LIBCPP_INLINE_VISIBILITY |
| 4702 | int |
| 4703 | atomic_exchange_explicit(volatile atomic_int* __obj, int __desr, |
| 4704 | memory_order __o) |
| 4705 | { |
| 4706 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 4707 | } |
| 4708 | |
| 4709 | inline _LIBCPP_INLINE_VISIBILITY |
| 4710 | int |
| 4711 | atomic_exchange_explicit(atomic_int* __obj, int __desr, memory_order __o) |
| 4712 | { |
| 4713 | return atomic_exchange_explicit(const_cast<volatile atomic_int*> |
| 4714 | (__obj), __desr, __o); |
| 4715 | } |
| 4716 | |
| 4717 | inline _LIBCPP_INLINE_VISIBILITY |
| 4718 | bool |
| 4719 | atomic_compare_exchange_weak(volatile atomic_int* __obj, int* __exp, |
| 4720 | int __desr) |
| 4721 | { |
| 4722 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 4723 | memory_order_seq_cst, memory_order_seq_cst); |
| 4724 | } |
| 4725 | |
| 4726 | inline _LIBCPP_INLINE_VISIBILITY |
| 4727 | bool |
| 4728 | atomic_compare_exchange_weak(atomic_int* __obj, int* __exp, int __desr) |
| 4729 | { |
| 4730 | return atomic_compare_exchange_weak(const_cast<volatile atomic_int*> |
| 4731 | (__obj), __exp, __desr); |
| 4732 | } |
| 4733 | |
| 4734 | inline _LIBCPP_INLINE_VISIBILITY |
| 4735 | bool |
| 4736 | atomic_compare_exchange_strong(volatile atomic_int* __obj, int* __exp, |
| 4737 | int __desr) |
| 4738 | { |
| 4739 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 4740 | memory_order_seq_cst, memory_order_seq_cst); |
| 4741 | } |
| 4742 | |
| 4743 | inline _LIBCPP_INLINE_VISIBILITY |
| 4744 | bool |
| 4745 | atomic_compare_exchange_strong(atomic_int* __obj, int* __exp, int __desr) |
| 4746 | { |
| 4747 | return atomic_compare_exchange_strong(const_cast<volatile atomic_int*> |
| 4748 | (__obj), __exp, __desr); |
| 4749 | } |
| 4750 | |
| 4751 | inline _LIBCPP_INLINE_VISIBILITY |
| 4752 | bool |
| 4753 | atomic_compare_exchange_weak_explicit(volatile atomic_int* __obj, int* __exp, |
| 4754 | int __desr, memory_order __s, |
| 4755 | memory_order __f) |
| 4756 | { |
| 4757 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 4758 | __f); |
| 4759 | } |
| 4760 | |
| 4761 | inline _LIBCPP_INLINE_VISIBILITY |
| 4762 | bool |
| 4763 | atomic_compare_exchange_weak_explicit(atomic_int* __obj, int* __exp, |
| 4764 | int __desr, memory_order __s, |
| 4765 | memory_order __f) |
| 4766 | { |
| 4767 | return atomic_compare_exchange_weak_explicit( |
| 4768 | const_cast<volatile atomic_int*>(__obj), __exp, __desr, __s, __f); |
| 4769 | } |
| 4770 | |
| 4771 | inline _LIBCPP_INLINE_VISIBILITY |
| 4772 | bool |
| 4773 | atomic_compare_exchange_strong_explicit(volatile atomic_int* __obj, |
| 4774 | int* __exp, int __desr, |
| 4775 | memory_order __s, memory_order __f) |
| 4776 | { |
| 4777 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 4778 | __f); |
| 4779 | } |
| 4780 | |
| 4781 | inline _LIBCPP_INLINE_VISIBILITY |
| 4782 | bool |
| 4783 | atomic_compare_exchange_strong_explicit(atomic_int* __obj, int* __exp, |
| 4784 | int __desr, memory_order __s, |
| 4785 | memory_order __f) |
| 4786 | { |
| 4787 | return atomic_compare_exchange_strong_explicit( |
| 4788 | const_cast<volatile atomic_int*>(__obj), __exp, __desr, __s, __f); |
| 4789 | } |
| 4790 | |
| 4791 | inline _LIBCPP_INLINE_VISIBILITY |
| 4792 | int |
| 4793 | atomic_fetch_add(volatile atomic_int* __obj, int __v) |
| 4794 | { |
| 4795 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 4796 | } |
| 4797 | |
| 4798 | inline _LIBCPP_INLINE_VISIBILITY |
| 4799 | int |
| 4800 | atomic_fetch_add(atomic_int* __obj, int __v) |
| 4801 | { |
| 4802 | return atomic_fetch_add(const_cast<volatile atomic_int*>(__obj), __v); |
| 4803 | } |
| 4804 | |
| 4805 | inline _LIBCPP_INLINE_VISIBILITY |
| 4806 | int |
| 4807 | atomic_fetch_add_explicit(volatile atomic_int* __obj, int __v, |
| 4808 | memory_order __o) |
| 4809 | { |
| 4810 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 4811 | } |
| 4812 | |
| 4813 | inline _LIBCPP_INLINE_VISIBILITY |
| 4814 | int |
| 4815 | atomic_fetch_add_explicit(atomic_int* __obj, int __v, memory_order __o) |
| 4816 | { |
| 4817 | return atomic_fetch_add_explicit(const_cast<volatile atomic_int*>(__obj), |
| 4818 | __v, __o); |
| 4819 | } |
| 4820 | |
| 4821 | inline _LIBCPP_INLINE_VISIBILITY |
| 4822 | int |
| 4823 | atomic_fetch_sub(volatile atomic_int* __obj, int __v) |
| 4824 | { |
| 4825 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 4826 | } |
| 4827 | |
| 4828 | inline _LIBCPP_INLINE_VISIBILITY |
| 4829 | int |
| 4830 | atomic_fetch_sub(atomic_int* __obj, int __v) |
| 4831 | { |
| 4832 | return atomic_fetch_sub(const_cast<volatile atomic_int*>(__obj), __v); |
| 4833 | } |
| 4834 | |
| 4835 | inline _LIBCPP_INLINE_VISIBILITY |
| 4836 | int |
| 4837 | atomic_fetch_sub_explicit(volatile atomic_int* __obj, int __v, |
| 4838 | memory_order __o) |
| 4839 | { |
| 4840 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 4841 | } |
| 4842 | |
| 4843 | inline _LIBCPP_INLINE_VISIBILITY |
| 4844 | int |
| 4845 | atomic_fetch_sub_explicit(atomic_int* __obj, int __v, memory_order __o) |
| 4846 | { |
| 4847 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_int*>(__obj), |
| 4848 | __v, __o); |
| 4849 | } |
| 4850 | |
| 4851 | inline _LIBCPP_INLINE_VISIBILITY |
| 4852 | int |
| 4853 | atomic_fetch_and(volatile atomic_int* __obj, int __v) |
| 4854 | { |
| 4855 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 4856 | } |
| 4857 | |
| 4858 | inline _LIBCPP_INLINE_VISIBILITY |
| 4859 | int |
| 4860 | atomic_fetch_and(atomic_int* __obj, int __v) |
| 4861 | { |
| 4862 | return atomic_fetch_and(const_cast<volatile atomic_int*>(__obj), __v); |
| 4863 | } |
| 4864 | |
| 4865 | inline _LIBCPP_INLINE_VISIBILITY |
| 4866 | int |
| 4867 | atomic_fetch_and_explicit(volatile atomic_int* __obj, int __v, |
| 4868 | memory_order __o) |
| 4869 | { |
| 4870 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 4871 | } |
| 4872 | |
| 4873 | inline _LIBCPP_INLINE_VISIBILITY |
| 4874 | int |
| 4875 | atomic_fetch_and_explicit(atomic_int* __obj, int __v, memory_order __o) |
| 4876 | { |
| 4877 | return atomic_fetch_and_explicit(const_cast<volatile atomic_int*>(__obj), |
| 4878 | __v, __o); |
| 4879 | } |
| 4880 | |
| 4881 | inline _LIBCPP_INLINE_VISIBILITY |
| 4882 | int |
| 4883 | atomic_fetch_or(volatile atomic_int* __obj, int __v) |
| 4884 | { |
| 4885 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 4886 | } |
| 4887 | |
| 4888 | inline _LIBCPP_INLINE_VISIBILITY |
| 4889 | int |
| 4890 | atomic_fetch_or(atomic_int* __obj, int __v) |
| 4891 | { |
| 4892 | return atomic_fetch_or(const_cast<volatile atomic_int*>(__obj), __v); |
| 4893 | } |
| 4894 | |
| 4895 | inline _LIBCPP_INLINE_VISIBILITY |
| 4896 | int |
| 4897 | atomic_fetch_or_explicit(volatile atomic_int* __obj, int __v, |
| 4898 | memory_order __o) |
| 4899 | { |
| 4900 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 4901 | } |
| 4902 | |
| 4903 | inline _LIBCPP_INLINE_VISIBILITY |
| 4904 | int |
| 4905 | atomic_fetch_or_explicit(atomic_int* __obj, int __v, memory_order __o) |
| 4906 | { |
| 4907 | return atomic_fetch_or_explicit(const_cast<volatile atomic_int*>(__obj), |
| 4908 | __v, __o); |
| 4909 | } |
| 4910 | |
| 4911 | inline _LIBCPP_INLINE_VISIBILITY |
| 4912 | int |
| 4913 | atomic_fetch_xor(volatile atomic_int* __obj, int __v) |
| 4914 | { |
| 4915 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 4916 | } |
| 4917 | |
| 4918 | inline _LIBCPP_INLINE_VISIBILITY |
| 4919 | int |
| 4920 | atomic_fetch_xor(atomic_int* __obj, int __v) |
| 4921 | { |
| 4922 | return atomic_fetch_xor(const_cast<volatile atomic_int*>(__obj), __v); |
| 4923 | } |
| 4924 | |
| 4925 | inline _LIBCPP_INLINE_VISIBILITY |
| 4926 | int |
| 4927 | atomic_fetch_xor_explicit(volatile atomic_int* __obj, int __v, |
| 4928 | memory_order __o) |
| 4929 | { |
| 4930 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 4931 | } |
| 4932 | |
| 4933 | inline _LIBCPP_INLINE_VISIBILITY |
| 4934 | int |
| 4935 | atomic_fetch_xor_explicit(atomic_int* __obj, int __v, memory_order __o) |
| 4936 | { |
| 4937 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_int*>(__obj), |
| 4938 | __v, __o); |
| 4939 | } |
| 4940 | |
| 4941 | // atomic_uint |
| 4942 | |
| 4943 | struct atomic_uint; |
| 4944 | |
| 4945 | bool atomic_is_lock_free(const volatile atomic_uint*); |
| 4946 | bool atomic_is_lock_free(const atomic_uint*); |
| 4947 | void atomic_init(volatile atomic_uint*, unsigned int); |
| 4948 | void atomic_init(atomic_uint*, unsigned int); |
| 4949 | void atomic_store(volatile atomic_uint*, unsigned int); |
| 4950 | void atomic_store(atomic_uint*, unsigned int); |
| 4951 | void atomic_store_explicit(volatile atomic_uint*, unsigned int, memory_order); |
| 4952 | void atomic_store_explicit(atomic_uint*, unsigned int, memory_order); |
| 4953 | unsigned int atomic_load(const volatile atomic_uint*); |
| 4954 | unsigned int atomic_load(const atomic_uint*); |
| 4955 | unsigned int atomic_load_explicit(const volatile atomic_uint*, memory_order); |
| 4956 | unsigned int atomic_load_explicit(const atomic_uint*, memory_order); |
| 4957 | unsigned int atomic_exchange(volatile atomic_uint*, unsigned int); |
| 4958 | unsigned int atomic_exchange(atomic_uint*, unsigned int); |
| 4959 | unsigned int atomic_exchange_explicit(volatile atomic_uint*, unsigned int, |
| 4960 | memory_order); |
| 4961 | unsigned int atomic_exchange_explicit(atomic_uint*, unsigned int, |
| 4962 | memory_order); |
| 4963 | bool atomic_compare_exchange_weak(volatile atomic_uint*, unsigned int*, |
| 4964 | unsigned int); |
| 4965 | bool atomic_compare_exchange_weak(atomic_uint*, unsigned int*, unsigned int); |
| 4966 | bool atomic_compare_exchange_strong(volatile atomic_uint*, unsigned int*, |
| 4967 | unsigned int); |
| 4968 | bool atomic_compare_exchange_strong(atomic_uint*, unsigned int*, |
| 4969 | unsigned int); |
| 4970 | bool atomic_compare_exchange_weak_explicit(volatile atomic_uint*, |
| 4971 | unsigned int*, unsigned int, |
| 4972 | memory_order, memory_order); |
| 4973 | bool atomic_compare_exchange_weak_explicit(atomic_uint*, unsigned int*, |
| 4974 | unsigned int, memory_order, |
| 4975 | memory_order); |
| 4976 | bool atomic_compare_exchange_strong_explicit(volatile atomic_uint*, |
| 4977 | unsigned int*, unsigned int, |
| 4978 | memory_order, memory_order); |
| 4979 | bool atomic_compare_exchange_strong_explicit(atomic_uint*, unsigned int*, |
| 4980 | unsigned int, memory_order, |
| 4981 | memory_order); |
| 4982 | unsigned int atomic_fetch_add(volatile atomic_uint*, unsigned int); |
| 4983 | unsigned int atomic_fetch_add(atomic_uint*, unsigned int); |
| 4984 | unsigned int atomic_fetch_add_explicit(volatile atomic_uint*, unsigned int, |
| 4985 | memory_order); |
| 4986 | unsigned int atomic_fetch_add_explicit(atomic_uint*, unsigned int, |
| 4987 | memory_order); |
| 4988 | unsigned int atomic_fetch_sub(volatile atomic_uint*, unsigned int); |
| 4989 | unsigned int atomic_fetch_sub(atomic_uint*, unsigned int); |
| 4990 | unsigned int atomic_fetch_sub_explicit(volatile atomic_uint*, unsigned int, |
| 4991 | memory_order); |
| 4992 | unsigned int atomic_fetch_sub_explicit(atomic_uint*, unsigned int, |
| 4993 | memory_order); |
| 4994 | unsigned int atomic_fetch_and(volatile atomic_uint*, unsigned int); |
| 4995 | unsigned int atomic_fetch_and(atomic_uint*, unsigned int); |
| 4996 | unsigned int atomic_fetch_and_explicit(volatile atomic_uint*, unsigned int, |
| 4997 | memory_order); |
| 4998 | unsigned int atomic_fetch_and_explicit(atomic_uint*, unsigned int, |
| 4999 | memory_order); |
| 5000 | unsigned int atomic_fetch_or(volatile atomic_uint*, unsigned int); |
| 5001 | unsigned int atomic_fetch_or(atomic_uint*, unsigned int); |
| 5002 | unsigned int atomic_fetch_or_explicit(volatile atomic_uint*, unsigned int, |
| 5003 | memory_order); |
| 5004 | unsigned int atomic_fetch_or_explicit(atomic_uint*, unsigned int, |
| 5005 | memory_order); |
| 5006 | unsigned int atomic_fetch_xor(volatile atomic_uint*, unsigned int); |
| 5007 | unsigned int atomic_fetch_xor(atomic_uint*, unsigned int); |
| 5008 | unsigned int atomic_fetch_xor_explicit(volatile atomic_uint*, unsigned int, |
| 5009 | memory_order); |
| 5010 | unsigned int atomic_fetch_xor_explicit(atomic_uint*, unsigned int, |
| 5011 | memory_order); |
| 5012 | |
| 5013 | typedef struct atomic_uint |
| 5014 | { |
| 5015 | unsigned int __v_; |
| 5016 | |
| 5017 | _LIBCPP_INLINE_VISIBILITY |
| 5018 | bool is_lock_free() const volatile |
| 5019 | {return atomic_is_lock_free(this);} |
| 5020 | _LIBCPP_INLINE_VISIBILITY |
| 5021 | bool is_lock_free() const |
| 5022 | {return atomic_is_lock_free(this);} |
| 5023 | _LIBCPP_INLINE_VISIBILITY |
| 5024 | void store(unsigned int __v, |
| 5025 | memory_order __o = memory_order_seq_cst) volatile |
| 5026 | {atomic_store_explicit(this, __v, __o);} |
| 5027 | _LIBCPP_INLINE_VISIBILITY |
| 5028 | void store(unsigned int __v, memory_order __o = memory_order_seq_cst) |
| 5029 | {atomic_store_explicit(this, __v, __o);} |
| 5030 | _LIBCPP_INLINE_VISIBILITY |
| 5031 | unsigned int load(memory_order __o = memory_order_seq_cst) const volatile |
| 5032 | {return atomic_load_explicit(this, __o);} |
| 5033 | _LIBCPP_INLINE_VISIBILITY |
| 5034 | unsigned int load(memory_order __o = memory_order_seq_cst) const |
| 5035 | {return atomic_load_explicit(this, __o);} |
| 5036 | _LIBCPP_INLINE_VISIBILITY |
| 5037 | operator unsigned int() const volatile |
| 5038 | {return load();} |
| 5039 | _LIBCPP_INLINE_VISIBILITY |
| 5040 | operator unsigned int() const |
| 5041 | {return load();} |
| 5042 | _LIBCPP_INLINE_VISIBILITY |
| 5043 | unsigned int exchange(unsigned int __v, |
| 5044 | memory_order __o = memory_order_seq_cst) volatile |
| 5045 | {return atomic_exchange_explicit(this, __v, __o);} |
| 5046 | _LIBCPP_INLINE_VISIBILITY |
| 5047 | unsigned int exchange(unsigned int __v, |
| 5048 | memory_order __o = memory_order_seq_cst) |
| 5049 | {return atomic_exchange_explicit(this, __v, __o);} |
| 5050 | _LIBCPP_INLINE_VISIBILITY |
| 5051 | bool compare_exchange_weak(unsigned int& __v, unsigned int __e, |
| 5052 | memory_order __s, memory_order __f) volatile |
| 5053 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 5054 | __f);} |
| 5055 | _LIBCPP_INLINE_VISIBILITY |
| 5056 | bool compare_exchange_weak(unsigned int& __v, unsigned int __e, |
| 5057 | memory_order __s, memory_order __f) |
| 5058 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 5059 | __f);} |
| 5060 | _LIBCPP_INLINE_VISIBILITY |
| 5061 | bool compare_exchange_strong(unsigned int& __v, unsigned int __e, |
| 5062 | memory_order __s, memory_order __f) volatile |
| 5063 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 5064 | __f);} |
| 5065 | _LIBCPP_INLINE_VISIBILITY |
| 5066 | bool compare_exchange_strong(unsigned int& __v, unsigned int __e, |
| 5067 | memory_order __s, memory_order __f) |
| 5068 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 5069 | __f);} |
| 5070 | _LIBCPP_INLINE_VISIBILITY |
| 5071 | bool compare_exchange_weak(unsigned int& __v, unsigned int __e, |
| 5072 | memory_order __s = memory_order_seq_cst) volatile |
| 5073 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 5074 | __translate_memory_order(__s));} |
| 5075 | _LIBCPP_INLINE_VISIBILITY |
| 5076 | bool compare_exchange_weak(unsigned int& __v, unsigned int __e, |
| 5077 | memory_order __s = memory_order_seq_cst) |
| 5078 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 5079 | __translate_memory_order(__s));} |
| 5080 | _LIBCPP_INLINE_VISIBILITY |
| 5081 | bool compare_exchange_strong(unsigned int& __v, unsigned int __e, |
| 5082 | memory_order __s = memory_order_seq_cst) volatile |
| 5083 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 5084 | __translate_memory_order(__s));} |
| 5085 | _LIBCPP_INLINE_VISIBILITY |
| 5086 | bool compare_exchange_strong(unsigned int& __v, unsigned int __e, |
| 5087 | memory_order __s = memory_order_seq_cst) |
| 5088 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 5089 | __translate_memory_order(__s));} |
| 5090 | _LIBCPP_INLINE_VISIBILITY |
| 5091 | unsigned int fetch_add(unsigned int __v, |
| 5092 | memory_order __o = memory_order_seq_cst) volatile |
| 5093 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 5094 | _LIBCPP_INLINE_VISIBILITY |
| 5095 | unsigned int fetch_add(unsigned int __v, |
| 5096 | memory_order __o = memory_order_seq_cst) |
| 5097 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 5098 | _LIBCPP_INLINE_VISIBILITY |
| 5099 | unsigned int fetch_sub(unsigned int __v, |
| 5100 | memory_order __o = memory_order_seq_cst) volatile |
| 5101 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 5102 | _LIBCPP_INLINE_VISIBILITY |
| 5103 | unsigned int fetch_sub(unsigned int __v, |
| 5104 | memory_order __o = memory_order_seq_cst) |
| 5105 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 5106 | _LIBCPP_INLINE_VISIBILITY |
| 5107 | unsigned int fetch_and(unsigned int __v, |
| 5108 | memory_order __o = memory_order_seq_cst) volatile |
| 5109 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 5110 | _LIBCPP_INLINE_VISIBILITY |
| 5111 | unsigned int fetch_and(unsigned int __v, |
| 5112 | memory_order __o = memory_order_seq_cst) |
| 5113 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 5114 | _LIBCPP_INLINE_VISIBILITY |
| 5115 | unsigned int fetch_or(unsigned int __v, |
| 5116 | memory_order __o = memory_order_seq_cst) volatile |
| 5117 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 5118 | _LIBCPP_INLINE_VISIBILITY |
| 5119 | unsigned int fetch_or(unsigned int __v, |
| 5120 | memory_order __o = memory_order_seq_cst) |
| 5121 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 5122 | _LIBCPP_INLINE_VISIBILITY |
| 5123 | unsigned int fetch_xor(unsigned int __v, |
| 5124 | memory_order __o = memory_order_seq_cst) volatile |
| 5125 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 5126 | _LIBCPP_INLINE_VISIBILITY |
| 5127 | unsigned int fetch_xor(unsigned int __v, |
| 5128 | memory_order __o = memory_order_seq_cst) |
| 5129 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 5130 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 5131 | atomic_uint() = default; |
| 5132 | #else |
| 5133 | _LIBCPP_INLINE_VISIBILITY |
| 5134 | atomic_uint() {} |
| 5135 | #endif |
| 5136 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 5137 | constexpr atomic_uint(unsigned int __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 5138 | : __v_(__v) {} |
| 5139 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 5140 | atomic_uint(const atomic_uint&) = delete; |
| 5141 | atomic_uint& operator=(const atomic_uint&) = delete; |
| 5142 | atomic_uint& operator=(const atomic_uint&) volatile = delete; |
| 5143 | #else |
| 5144 | private: |
| 5145 | atomic_uint(const atomic_uint&); |
| 5146 | atomic_uint& operator=(const atomic_uint&); |
| 5147 | atomic_uint& operator=(const atomic_uint&) volatile; |
| 5148 | public: |
| 5149 | #endif |
| 5150 | _LIBCPP_INLINE_VISIBILITY |
| 5151 | unsigned int operator=(unsigned int __v) volatile |
| 5152 | {store(__v); return __v;} |
| 5153 | _LIBCPP_INLINE_VISIBILITY |
| 5154 | unsigned int operator=(unsigned int __v) |
| 5155 | {store(__v); return __v;} |
| 5156 | _LIBCPP_INLINE_VISIBILITY |
| 5157 | unsigned int operator++(int) volatile |
| 5158 | {typedef unsigned int type; return fetch_add(type(1));} |
| 5159 | _LIBCPP_INLINE_VISIBILITY |
| 5160 | int operator++(int) |
| 5161 | {typedef unsigned int type; return fetch_add(type(1));} |
| 5162 | _LIBCPP_INLINE_VISIBILITY |
| 5163 | int operator--(int) volatile |
| 5164 | {typedef unsigned int type; return fetch_sub(type(1));} |
| 5165 | _LIBCPP_INLINE_VISIBILITY |
| 5166 | int operator--(int) |
| 5167 | {typedef unsigned int type; return fetch_sub(type(1));} |
| 5168 | _LIBCPP_INLINE_VISIBILITY |
| 5169 | int operator++() volatile |
| 5170 | {typedef unsigned int type; return type(fetch_add(type(1)) + 1);} |
| 5171 | _LIBCPP_INLINE_VISIBILITY |
| 5172 | int operator++() |
| 5173 | {typedef unsigned int type; return type(fetch_add(type(1)) + 1);} |
| 5174 | _LIBCPP_INLINE_VISIBILITY |
| 5175 | int operator--() volatile |
| 5176 | {typedef unsigned int type; return type(fetch_sub(type(1)) - 1);} |
| 5177 | _LIBCPP_INLINE_VISIBILITY |
| 5178 | int operator--() |
| 5179 | {typedef unsigned int type; return type(fetch_sub(type(1)) - 1);} |
| 5180 | _LIBCPP_INLINE_VISIBILITY |
| 5181 | int operator+=(int __v) volatile |
| 5182 | {typedef unsigned int type; return type(fetch_add(__v) + __v);} |
| 5183 | _LIBCPP_INLINE_VISIBILITY |
| 5184 | int operator+=(int __v) |
| 5185 | {typedef unsigned int type; return type(fetch_add(__v) + __v);} |
| 5186 | _LIBCPP_INLINE_VISIBILITY |
| 5187 | int operator-=(int __v) volatile |
| 5188 | {typedef unsigned int type; return type(fetch_sub(__v) - __v);} |
| 5189 | _LIBCPP_INLINE_VISIBILITY |
| 5190 | int operator-=(int __v) |
| 5191 | {typedef unsigned int type; return type(fetch_sub(__v) - __v);} |
| 5192 | _LIBCPP_INLINE_VISIBILITY |
| 5193 | int operator&=(int __v) volatile |
| 5194 | {typedef unsigned int type; return type(fetch_and(__v) & __v);} |
| 5195 | _LIBCPP_INLINE_VISIBILITY |
| 5196 | int operator&=(int __v) |
| 5197 | {typedef unsigned int type; return type(fetch_and(__v) & __v);} |
| 5198 | _LIBCPP_INLINE_VISIBILITY |
| 5199 | int operator|=(int __v) volatile |
| 5200 | {typedef unsigned int type; return type(fetch_or(__v) | __v);} |
| 5201 | _LIBCPP_INLINE_VISIBILITY |
| 5202 | int operator|=(int __v) |
| 5203 | {typedef unsigned int type; return type(fetch_or(__v) | __v);} |
| 5204 | _LIBCPP_INLINE_VISIBILITY |
| 5205 | int operator^=(int __v) volatile |
| 5206 | {typedef unsigned int type; return type(fetch_xor(__v) ^ __v);} |
| 5207 | _LIBCPP_INLINE_VISIBILITY |
| 5208 | int operator^=(int __v) |
| 5209 | {typedef unsigned int type; return type(fetch_xor(__v) ^ __v);} |
| 5210 | } atomic_uint; |
| 5211 | |
| 5212 | inline _LIBCPP_INLINE_VISIBILITY |
| 5213 | bool |
| 5214 | atomic_is_lock_free(const volatile atomic_uint*) |
| 5215 | { |
| 5216 | typedef unsigned int type; |
| 5217 | return __atomic_is_lock_free(type); |
| 5218 | } |
| 5219 | |
| 5220 | inline _LIBCPP_INLINE_VISIBILITY |
| 5221 | bool |
| 5222 | atomic_is_lock_free(const atomic_uint* __obj) |
| 5223 | { |
| 5224 | return atomic_is_lock_free(const_cast<volatile atomic_uint*>(__obj)); |
| 5225 | } |
| 5226 | |
| 5227 | inline _LIBCPP_INLINE_VISIBILITY |
| 5228 | void |
| 5229 | atomic_init(volatile atomic_uint* __obj, unsigned int __desr) |
| 5230 | { |
| 5231 | __obj->__v_ = __desr; |
| 5232 | } |
| 5233 | |
| 5234 | inline _LIBCPP_INLINE_VISIBILITY |
| 5235 | void |
| 5236 | atomic_init(atomic_uint* __obj, unsigned int __desr) |
| 5237 | { |
| 5238 | __obj->__v_ = __desr; |
| 5239 | } |
| 5240 | |
| 5241 | inline _LIBCPP_INLINE_VISIBILITY |
| 5242 | void |
| 5243 | atomic_store(volatile atomic_uint* __obj, unsigned int __desr) |
| 5244 | { |
| 5245 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 5246 | } |
| 5247 | |
| 5248 | inline _LIBCPP_INLINE_VISIBILITY |
| 5249 | void |
| 5250 | atomic_store(atomic_uint* __obj, unsigned int __desr) |
| 5251 | { |
| 5252 | atomic_store(const_cast<volatile atomic_uint*>(__obj), __desr); |
| 5253 | } |
| 5254 | |
| 5255 | inline _LIBCPP_INLINE_VISIBILITY |
| 5256 | void |
| 5257 | atomic_store_explicit(volatile atomic_uint* __obj, unsigned int __desr, |
| 5258 | memory_order __o) |
| 5259 | { |
| 5260 | __atomic_store(&__obj->__v_, __desr, __o); |
| 5261 | } |
| 5262 | |
| 5263 | inline _LIBCPP_INLINE_VISIBILITY |
| 5264 | void |
| 5265 | atomic_store_explicit(atomic_uint* __obj, unsigned int __desr, |
| 5266 | memory_order __o) |
| 5267 | { |
| 5268 | atomic_store_explicit(const_cast<volatile atomic_uint*>(__obj), __desr, |
| 5269 | __o); |
| 5270 | } |
| 5271 | |
| 5272 | inline _LIBCPP_INLINE_VISIBILITY |
| 5273 | unsigned int |
| 5274 | atomic_load(const volatile atomic_uint* __obj) |
| 5275 | { |
| 5276 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 5277 | } |
| 5278 | |
| 5279 | inline _LIBCPP_INLINE_VISIBILITY |
| 5280 | unsigned int |
| 5281 | atomic_load(const atomic_uint* __obj) |
| 5282 | { |
| 5283 | return atomic_load(const_cast<const volatile atomic_uint*>(__obj)); |
| 5284 | } |
| 5285 | |
| 5286 | inline _LIBCPP_INLINE_VISIBILITY |
| 5287 | unsigned int |
| 5288 | atomic_load_explicit(const volatile atomic_uint* __obj, memory_order __o) |
| 5289 | { |
| 5290 | return __atomic_load(&__obj->__v_, __o); |
| 5291 | } |
| 5292 | |
| 5293 | inline _LIBCPP_INLINE_VISIBILITY |
| 5294 | unsigned int |
| 5295 | atomic_load_explicit(const atomic_uint* __obj, memory_order __o) |
| 5296 | { |
| 5297 | return atomic_load_explicit(const_cast<const volatile atomic_uint*> |
| 5298 | (__obj), __o); |
| 5299 | } |
| 5300 | |
| 5301 | inline _LIBCPP_INLINE_VISIBILITY |
| 5302 | unsigned int |
| 5303 | atomic_exchange(volatile atomic_uint* __obj, unsigned int __desr) |
| 5304 | { |
| 5305 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 5306 | } |
| 5307 | |
| 5308 | inline _LIBCPP_INLINE_VISIBILITY |
| 5309 | unsigned int |
| 5310 | atomic_exchange(atomic_uint* __obj, unsigned int __desr) |
| 5311 | { |
| 5312 | return atomic_exchange(const_cast<volatile atomic_uint*>(__obj), __desr); |
| 5313 | } |
| 5314 | |
| 5315 | inline _LIBCPP_INLINE_VISIBILITY |
| 5316 | unsigned int |
| 5317 | atomic_exchange_explicit(volatile atomic_uint* __obj, unsigned int __desr, |
| 5318 | memory_order __o) |
| 5319 | { |
| 5320 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 5321 | } |
| 5322 | |
| 5323 | inline _LIBCPP_INLINE_VISIBILITY |
| 5324 | unsigned int |
| 5325 | atomic_exchange_explicit(atomic_uint* __obj, unsigned int __desr, |
| 5326 | memory_order __o) |
| 5327 | { |
| 5328 | return atomic_exchange_explicit(const_cast<volatile atomic_uint*> |
| 5329 | (__obj), __desr, __o); |
| 5330 | } |
| 5331 | |
| 5332 | inline _LIBCPP_INLINE_VISIBILITY |
| 5333 | bool |
| 5334 | atomic_compare_exchange_weak(volatile atomic_uint* __obj, unsigned int* __exp, |
| 5335 | unsigned int __desr) |
| 5336 | { |
| 5337 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 5338 | memory_order_seq_cst, memory_order_seq_cst); |
| 5339 | } |
| 5340 | |
| 5341 | inline _LIBCPP_INLINE_VISIBILITY |
| 5342 | bool |
| 5343 | atomic_compare_exchange_weak(atomic_uint* __obj, unsigned int* __exp, |
| 5344 | unsigned int __desr) |
| 5345 | { |
| 5346 | return atomic_compare_exchange_weak(const_cast<volatile atomic_uint*> |
| 5347 | (__obj), __exp, __desr); |
| 5348 | } |
| 5349 | |
| 5350 | inline _LIBCPP_INLINE_VISIBILITY |
| 5351 | bool |
| 5352 | atomic_compare_exchange_strong(volatile atomic_uint* __obj, |
| 5353 | unsigned int* __exp, unsigned int __desr) |
| 5354 | { |
| 5355 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 5356 | memory_order_seq_cst, memory_order_seq_cst); |
| 5357 | } |
| 5358 | |
| 5359 | inline _LIBCPP_INLINE_VISIBILITY |
| 5360 | bool |
| 5361 | atomic_compare_exchange_strong(atomic_uint* __obj, unsigned int* __exp, |
| 5362 | unsigned int __desr) |
| 5363 | { |
| 5364 | return atomic_compare_exchange_strong(const_cast<volatile atomic_uint*> |
| 5365 | (__obj), __exp, __desr); |
| 5366 | } |
| 5367 | |
| 5368 | inline _LIBCPP_INLINE_VISIBILITY |
| 5369 | bool |
| 5370 | atomic_compare_exchange_weak_explicit(volatile atomic_uint* __obj, |
| 5371 | unsigned int* __exp, |
| 5372 | unsigned int __desr, memory_order __s, |
| 5373 | memory_order __f) |
| 5374 | { |
| 5375 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 5376 | __f); |
| 5377 | } |
| 5378 | |
| 5379 | inline _LIBCPP_INLINE_VISIBILITY |
| 5380 | bool |
| 5381 | atomic_compare_exchange_weak_explicit(atomic_uint* __obj, unsigned int* __exp, |
| 5382 | unsigned int __desr, memory_order __s, |
| 5383 | memory_order __f) |
| 5384 | { |
| 5385 | return atomic_compare_exchange_weak_explicit( |
| 5386 | const_cast<volatile atomic_uint*>(__obj), __exp, __desr, __s, __f); |
| 5387 | } |
| 5388 | |
| 5389 | inline _LIBCPP_INLINE_VISIBILITY |
| 5390 | bool |
| 5391 | atomic_compare_exchange_strong_explicit(volatile atomic_uint* __obj, |
| 5392 | unsigned int* __exp, |
| 5393 | unsigned int __desr, memory_order __s, |
| 5394 | memory_order __f) |
| 5395 | { |
| 5396 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 5397 | __f); |
| 5398 | } |
| 5399 | |
| 5400 | inline _LIBCPP_INLINE_VISIBILITY |
| 5401 | bool |
| 5402 | atomic_compare_exchange_strong_explicit(atomic_uint* __obj, |
| 5403 | unsigned int* __exp, |
| 5404 | unsigned int __desr, memory_order __s, |
| 5405 | memory_order __f) |
| 5406 | { |
| 5407 | return atomic_compare_exchange_strong_explicit( |
| 5408 | const_cast<volatile atomic_uint*>(__obj), __exp, __desr, __s, __f); |
| 5409 | } |
| 5410 | |
| 5411 | inline _LIBCPP_INLINE_VISIBILITY |
| 5412 | unsigned int |
| 5413 | atomic_fetch_add(volatile atomic_uint* __obj, unsigned int __v) |
| 5414 | { |
| 5415 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 5416 | } |
| 5417 | |
| 5418 | inline _LIBCPP_INLINE_VISIBILITY |
| 5419 | unsigned int |
| 5420 | atomic_fetch_add(atomic_uint* __obj, unsigned int __v) |
| 5421 | { |
| 5422 | return atomic_fetch_add(const_cast<volatile atomic_uint*>(__obj), __v); |
| 5423 | } |
| 5424 | |
| 5425 | inline _LIBCPP_INLINE_VISIBILITY |
| 5426 | unsigned int |
| 5427 | atomic_fetch_add_explicit(volatile atomic_uint* __obj, unsigned int __v, |
| 5428 | memory_order __o) |
| 5429 | { |
| 5430 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 5431 | } |
| 5432 | |
| 5433 | inline _LIBCPP_INLINE_VISIBILITY |
| 5434 | unsigned int |
| 5435 | atomic_fetch_add_explicit(atomic_uint* __obj, unsigned int __v, |
| 5436 | memory_order __o) |
| 5437 | { |
| 5438 | return atomic_fetch_add_explicit(const_cast<volatile atomic_uint*>(__obj), |
| 5439 | __v, __o); |
| 5440 | } |
| 5441 | |
| 5442 | inline _LIBCPP_INLINE_VISIBILITY |
| 5443 | unsigned int |
| 5444 | atomic_fetch_sub(volatile atomic_uint* __obj, unsigned int __v) |
| 5445 | { |
| 5446 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 5447 | } |
| 5448 | |
| 5449 | inline _LIBCPP_INLINE_VISIBILITY |
| 5450 | unsigned int |
| 5451 | atomic_fetch_sub(atomic_uint* __obj, unsigned int __v) |
| 5452 | { |
| 5453 | return atomic_fetch_sub(const_cast<volatile atomic_uint*>(__obj), __v); |
| 5454 | } |
| 5455 | |
| 5456 | inline _LIBCPP_INLINE_VISIBILITY |
| 5457 | unsigned int |
| 5458 | atomic_fetch_sub_explicit(volatile atomic_uint* __obj, unsigned int __v, |
| 5459 | memory_order __o) |
| 5460 | { |
| 5461 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 5462 | } |
| 5463 | |
| 5464 | inline _LIBCPP_INLINE_VISIBILITY |
| 5465 | unsigned int |
| 5466 | atomic_fetch_sub_explicit(atomic_uint* __obj, unsigned int __v, |
| 5467 | memory_order __o) |
| 5468 | { |
| 5469 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_uint*>(__obj), |
| 5470 | __v, __o); |
| 5471 | } |
| 5472 | |
| 5473 | inline _LIBCPP_INLINE_VISIBILITY |
| 5474 | unsigned int |
| 5475 | atomic_fetch_and(volatile atomic_uint* __obj, unsigned int __v) |
| 5476 | { |
| 5477 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 5478 | } |
| 5479 | |
| 5480 | inline _LIBCPP_INLINE_VISIBILITY |
| 5481 | unsigned int |
| 5482 | atomic_fetch_and(atomic_uint* __obj, unsigned int __v) |
| 5483 | { |
| 5484 | return atomic_fetch_and(const_cast<volatile atomic_uint*>(__obj), __v); |
| 5485 | } |
| 5486 | |
| 5487 | inline _LIBCPP_INLINE_VISIBILITY |
| 5488 | unsigned int |
| 5489 | atomic_fetch_and_explicit(volatile atomic_uint* __obj, unsigned int __v, |
| 5490 | memory_order __o) |
| 5491 | { |
| 5492 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 5493 | } |
| 5494 | |
| 5495 | inline _LIBCPP_INLINE_VISIBILITY |
| 5496 | unsigned int |
| 5497 | atomic_fetch_and_explicit(atomic_uint* __obj, unsigned int __v, |
| 5498 | memory_order __o) |
| 5499 | { |
| 5500 | return atomic_fetch_and_explicit(const_cast<volatile atomic_uint*>(__obj), |
| 5501 | __v, __o); |
| 5502 | } |
| 5503 | |
| 5504 | inline _LIBCPP_INLINE_VISIBILITY |
| 5505 | unsigned int |
| 5506 | atomic_fetch_or(volatile atomic_uint* __obj, unsigned int __v) |
| 5507 | { |
| 5508 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 5509 | } |
| 5510 | |
| 5511 | inline _LIBCPP_INLINE_VISIBILITY |
| 5512 | unsigned int |
| 5513 | atomic_fetch_or(atomic_uint* __obj, unsigned int __v) |
| 5514 | { |
| 5515 | return atomic_fetch_or(const_cast<volatile atomic_uint*>(__obj), __v); |
| 5516 | } |
| 5517 | |
| 5518 | inline _LIBCPP_INLINE_VISIBILITY |
| 5519 | unsigned int |
| 5520 | atomic_fetch_or_explicit(volatile atomic_uint* __obj, unsigned int __v, |
| 5521 | memory_order __o) |
| 5522 | { |
| 5523 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 5524 | } |
| 5525 | |
| 5526 | inline _LIBCPP_INLINE_VISIBILITY |
| 5527 | unsigned int |
| 5528 | atomic_fetch_or_explicit(atomic_uint* __obj, unsigned int __v, |
| 5529 | memory_order __o) |
| 5530 | { |
| 5531 | return atomic_fetch_or_explicit(const_cast<volatile atomic_uint*>(__obj), |
| 5532 | __v, __o); |
| 5533 | } |
| 5534 | |
| 5535 | inline _LIBCPP_INLINE_VISIBILITY |
| 5536 | unsigned int |
| 5537 | atomic_fetch_xor(volatile atomic_uint* __obj, unsigned int __v) |
| 5538 | { |
| 5539 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 5540 | } |
| 5541 | |
| 5542 | inline _LIBCPP_INLINE_VISIBILITY |
| 5543 | unsigned int |
| 5544 | atomic_fetch_xor(atomic_uint* __obj, unsigned int __v) |
| 5545 | { |
| 5546 | return atomic_fetch_xor(const_cast<volatile atomic_uint*>(__obj), __v); |
| 5547 | } |
| 5548 | |
| 5549 | inline _LIBCPP_INLINE_VISIBILITY |
| 5550 | unsigned int |
| 5551 | atomic_fetch_xor_explicit(volatile atomic_uint* __obj, unsigned int __v, |
| 5552 | memory_order __o) |
| 5553 | { |
| 5554 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 5555 | } |
| 5556 | |
| 5557 | inline _LIBCPP_INLINE_VISIBILITY |
| 5558 | unsigned int |
| 5559 | atomic_fetch_xor_explicit(atomic_uint* __obj, unsigned int __v, |
| 5560 | memory_order __o) |
| 5561 | { |
| 5562 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_uint*>(__obj), |
| 5563 | __v, __o); |
| 5564 | } |
| 5565 | |
| 5566 | // atomic_long |
| 5567 | |
| 5568 | struct atomic_long; |
| 5569 | |
| 5570 | bool atomic_is_lock_free(const volatile atomic_long*); |
| 5571 | bool atomic_is_lock_free(const atomic_long*); |
| 5572 | void atomic_init(volatile atomic_long*, long); |
| 5573 | void atomic_init(atomic_long*, long); |
| 5574 | void atomic_store(volatile atomic_long*, long); |
| 5575 | void atomic_store(atomic_long*, long); |
| 5576 | void atomic_store_explicit(volatile atomic_long*, long, memory_order); |
| 5577 | void atomic_store_explicit(atomic_long*, long, memory_order); |
| 5578 | long atomic_load(const volatile atomic_long*); |
| 5579 | long atomic_load(const atomic_long*); |
| 5580 | long atomic_load_explicit(const volatile atomic_long*, memory_order); |
| 5581 | long atomic_load_explicit(const atomic_long*, memory_order); |
| 5582 | long atomic_exchange(volatile atomic_long*, long); |
| 5583 | long atomic_exchange(atomic_long*, long); |
| 5584 | long atomic_exchange_explicit(volatile atomic_long*, long, memory_order); |
| 5585 | long atomic_exchange_explicit(atomic_long*, long, memory_order); |
| 5586 | bool atomic_compare_exchange_weak(volatile atomic_long*, long*, long); |
| 5587 | bool atomic_compare_exchange_weak(atomic_long*, long*, long); |
| 5588 | bool atomic_compare_exchange_strong(volatile atomic_long*, long*, long); |
| 5589 | bool atomic_compare_exchange_strong(atomic_long*, long*, long); |
| 5590 | bool atomic_compare_exchange_weak_explicit(volatile atomic_long*, long*, long, |
| 5591 | memory_order, memory_order); |
| 5592 | bool atomic_compare_exchange_weak_explicit(atomic_long*, long*, long, |
| 5593 | memory_order, memory_order); |
| 5594 | bool atomic_compare_exchange_strong_explicit(volatile atomic_long*, long*, long, |
| 5595 | memory_order, memory_order); |
| 5596 | bool atomic_compare_exchange_strong_explicit(atomic_long*, long*, long, |
| 5597 | memory_order, memory_order); |
| 5598 | long atomic_fetch_add(volatile atomic_long*, long); |
| 5599 | long atomic_fetch_add(atomic_long*, long); |
| 5600 | long atomic_fetch_add_explicit(volatile atomic_long*, long, memory_order); |
| 5601 | long atomic_fetch_add_explicit(atomic_long*, long, memory_order); |
| 5602 | long atomic_fetch_sub(volatile atomic_long*, long); |
| 5603 | long atomic_fetch_sub(atomic_long*, long); |
| 5604 | long atomic_fetch_sub_explicit(volatile atomic_long*, long, memory_order); |
| 5605 | long atomic_fetch_sub_explicit(atomic_long*, long, memory_order); |
| 5606 | long atomic_fetch_and(volatile atomic_long*, long); |
| 5607 | long atomic_fetch_and(atomic_long*, long); |
| 5608 | long atomic_fetch_and_explicit(volatile atomic_long*, long, memory_order); |
| 5609 | long atomic_fetch_and_explicit(atomic_long*, long, memory_order); |
| 5610 | long atomic_fetch_or(volatile atomic_long*, long); |
| 5611 | long atomic_fetch_or(atomic_long*, long); |
| 5612 | long atomic_fetch_or_explicit(volatile atomic_long*, long, memory_order); |
| 5613 | long atomic_fetch_or_explicit(atomic_long*, long, memory_order); |
| 5614 | long atomic_fetch_xor(volatile atomic_long*, long); |
| 5615 | long atomic_fetch_xor(atomic_long*, long); |
| 5616 | long atomic_fetch_xor_explicit(volatile atomic_long*, long, memory_order); |
| 5617 | long atomic_fetch_xor_explicit(atomic_long*, long, memory_order); |
| 5618 | |
| 5619 | typedef struct atomic_long |
| 5620 | { |
| 5621 | long __v_; |
| 5622 | |
| 5623 | _LIBCPP_INLINE_VISIBILITY |
| 5624 | bool is_lock_free() const volatile |
| 5625 | {return atomic_is_lock_free(this);} |
| 5626 | _LIBCPP_INLINE_VISIBILITY |
| 5627 | bool is_lock_free() const |
| 5628 | {return atomic_is_lock_free(this);} |
| 5629 | _LIBCPP_INLINE_VISIBILITY |
| 5630 | void store(long __v, memory_order __o = memory_order_seq_cst) volatile |
| 5631 | {atomic_store_explicit(this, __v, __o);} |
| 5632 | _LIBCPP_INLINE_VISIBILITY |
| 5633 | void store(long __v, memory_order __o = memory_order_seq_cst) |
| 5634 | {atomic_store_explicit(this, __v, __o);} |
| 5635 | _LIBCPP_INLINE_VISIBILITY |
| 5636 | long load(memory_order __o = memory_order_seq_cst) const volatile |
| 5637 | {return atomic_load_explicit(this, __o);} |
| 5638 | _LIBCPP_INLINE_VISIBILITY |
| 5639 | long load(memory_order __o = memory_order_seq_cst) const |
| 5640 | {return atomic_load_explicit(this, __o);} |
| 5641 | _LIBCPP_INLINE_VISIBILITY |
| 5642 | operator long() const volatile |
| 5643 | {return load();} |
| 5644 | _LIBCPP_INLINE_VISIBILITY |
| 5645 | operator long() const |
| 5646 | {return load();} |
| 5647 | _LIBCPP_INLINE_VISIBILITY |
| 5648 | long exchange(long __v, memory_order __o = memory_order_seq_cst) volatile |
| 5649 | {return atomic_exchange_explicit(this, __v, __o);} |
| 5650 | _LIBCPP_INLINE_VISIBILITY |
| 5651 | long exchange(long __v, memory_order __o = memory_order_seq_cst) |
| 5652 | {return atomic_exchange_explicit(this, __v, __o);} |
| 5653 | _LIBCPP_INLINE_VISIBILITY |
| 5654 | bool compare_exchange_weak(long& __v, long __e, memory_order __s, |
| 5655 | memory_order __f) volatile |
| 5656 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 5657 | __f);} |
| 5658 | _LIBCPP_INLINE_VISIBILITY |
| 5659 | bool compare_exchange_weak(long& __v, long __e, memory_order __s, |
| 5660 | memory_order __f) |
| 5661 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 5662 | __f);} |
| 5663 | _LIBCPP_INLINE_VISIBILITY |
| 5664 | bool compare_exchange_strong(long& __v, long __e, memory_order __s, |
| 5665 | memory_order __f) volatile |
| 5666 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 5667 | __f);} |
| 5668 | _LIBCPP_INLINE_VISIBILITY |
| 5669 | bool compare_exchange_strong(long& __v, long __e, memory_order __s, |
| 5670 | memory_order __f) |
| 5671 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 5672 | __f);} |
| 5673 | _LIBCPP_INLINE_VISIBILITY |
| 5674 | bool compare_exchange_weak(long& __v, long __e, |
| 5675 | memory_order __s = memory_order_seq_cst) volatile |
| 5676 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 5677 | __translate_memory_order(__s));} |
| 5678 | _LIBCPP_INLINE_VISIBILITY |
| 5679 | bool compare_exchange_weak(long& __v, long __e, |
| 5680 | memory_order __s = memory_order_seq_cst) |
| 5681 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 5682 | __translate_memory_order(__s));} |
| 5683 | _LIBCPP_INLINE_VISIBILITY |
| 5684 | bool compare_exchange_strong(long& __v, long __e, |
| 5685 | memory_order __s = memory_order_seq_cst) volatile |
| 5686 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 5687 | __translate_memory_order(__s));} |
| 5688 | _LIBCPP_INLINE_VISIBILITY |
| 5689 | bool compare_exchange_strong(long& __v, long __e, |
| 5690 | memory_order __s = memory_order_seq_cst) |
| 5691 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 5692 | __translate_memory_order(__s));} |
| 5693 | _LIBCPP_INLINE_VISIBILITY |
| 5694 | long fetch_add(long __v, memory_order __o = memory_order_seq_cst) volatile |
| 5695 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 5696 | _LIBCPP_INLINE_VISIBILITY |
| 5697 | long fetch_add(long __v, memory_order __o = memory_order_seq_cst) |
| 5698 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 5699 | _LIBCPP_INLINE_VISIBILITY |
| 5700 | long fetch_sub(long __v, memory_order __o = memory_order_seq_cst) volatile |
| 5701 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 5702 | _LIBCPP_INLINE_VISIBILITY |
| 5703 | long fetch_sub(long __v, memory_order __o = memory_order_seq_cst) |
| 5704 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 5705 | _LIBCPP_INLINE_VISIBILITY |
| 5706 | long fetch_and(long __v, memory_order __o = memory_order_seq_cst) volatile |
| 5707 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 5708 | _LIBCPP_INLINE_VISIBILITY |
| 5709 | long fetch_and(long __v, memory_order __o = memory_order_seq_cst) |
| 5710 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 5711 | _LIBCPP_INLINE_VISIBILITY |
| 5712 | long fetch_or(long __v, memory_order __o = memory_order_seq_cst) volatile |
| 5713 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 5714 | _LIBCPP_INLINE_VISIBILITY |
| 5715 | long fetch_or(long __v, memory_order __o = memory_order_seq_cst) |
| 5716 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 5717 | _LIBCPP_INLINE_VISIBILITY |
| 5718 | long fetch_xor(long __v, memory_order __o = memory_order_seq_cst) volatile |
| 5719 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 5720 | _LIBCPP_INLINE_VISIBILITY |
| 5721 | long fetch_xor(long __v, memory_order __o = memory_order_seq_cst) |
| 5722 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 5723 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 5724 | atomic_long() = default; |
| 5725 | #else |
| 5726 | _LIBCPP_INLINE_VISIBILITY |
| 5727 | atomic_long() {} |
| 5728 | #endif |
| 5729 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 5730 | constexpr atomic_long(long __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 5731 | : __v_(__v) {} |
| 5732 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 5733 | atomic_long(const atomic_long&) = delete; |
| 5734 | atomic_long& operator=(const atomic_long&) = delete; |
| 5735 | atomic_long& operator=(const atomic_long&) volatile = delete; |
| 5736 | #else |
| 5737 | private: |
| 5738 | atomic_long(const atomic_long&); |
| 5739 | atomic_long& operator=(const atomic_long&); |
| 5740 | atomic_long& operator=(const atomic_long&) volatile; |
| 5741 | public: |
| 5742 | #endif |
| 5743 | _LIBCPP_INLINE_VISIBILITY |
| 5744 | long operator=(long __v) volatile |
| 5745 | {store(__v); return __v;} |
| 5746 | _LIBCPP_INLINE_VISIBILITY |
| 5747 | long operator=(long __v) |
| 5748 | {store(__v); return __v;} |
| 5749 | _LIBCPP_INLINE_VISIBILITY |
| 5750 | long operator++(int) volatile |
| 5751 | {return fetch_add(long(1));} |
| 5752 | _LIBCPP_INLINE_VISIBILITY |
| 5753 | long operator++(int) |
| 5754 | {return fetch_add(long(1));} |
| 5755 | _LIBCPP_INLINE_VISIBILITY |
| 5756 | long operator--(int) volatile |
| 5757 | {return fetch_sub(long(1));} |
| 5758 | _LIBCPP_INLINE_VISIBILITY |
| 5759 | long operator--(int) |
| 5760 | {return fetch_sub(long(1));} |
| 5761 | _LIBCPP_INLINE_VISIBILITY |
| 5762 | long operator++() volatile |
| 5763 | {return long(fetch_add(long(1)) + 1);} |
| 5764 | _LIBCPP_INLINE_VISIBILITY |
| 5765 | long operator++() |
| 5766 | {return long(fetch_add(long(1)) + 1);} |
| 5767 | _LIBCPP_INLINE_VISIBILITY |
| 5768 | long operator--() volatile |
| 5769 | {return long(fetch_sub(long(1)) - 1);} |
| 5770 | _LIBCPP_INLINE_VISIBILITY |
| 5771 | long operator--() |
| 5772 | {return long(fetch_sub(long(1)) - 1);} |
| 5773 | _LIBCPP_INLINE_VISIBILITY |
| 5774 | long operator+=(long __v) volatile |
| 5775 | {return long(fetch_add(__v) + __v);} |
| 5776 | _LIBCPP_INLINE_VISIBILITY |
| 5777 | long operator+=(long __v) |
| 5778 | {return long(fetch_add(__v) + __v);} |
| 5779 | _LIBCPP_INLINE_VISIBILITY |
| 5780 | long operator-=(long __v) volatile |
| 5781 | {return long(fetch_sub(__v) - __v);} |
| 5782 | _LIBCPP_INLINE_VISIBILITY |
| 5783 | long operator-=(long __v) |
| 5784 | {return long(fetch_sub(__v) - __v);} |
| 5785 | _LIBCPP_INLINE_VISIBILITY |
| 5786 | long operator&=(long __v) volatile |
| 5787 | {return long(fetch_and(__v) & __v);} |
| 5788 | _LIBCPP_INLINE_VISIBILITY |
| 5789 | long operator&=(long __v) |
| 5790 | {return long(fetch_and(__v) & __v);} |
| 5791 | _LIBCPP_INLINE_VISIBILITY |
| 5792 | long operator|=(long __v) volatile |
| 5793 | {return long(fetch_or(__v) | __v);} |
| 5794 | _LIBCPP_INLINE_VISIBILITY |
| 5795 | long operator|=(long __v) |
| 5796 | {return long(fetch_or(__v) | __v);} |
| 5797 | _LIBCPP_INLINE_VISIBILITY |
| 5798 | long operator^=(long __v) volatile |
| 5799 | {return long(fetch_xor(__v) ^ __v);} |
| 5800 | _LIBCPP_INLINE_VISIBILITY |
| 5801 | long operator^=(long __v) |
| 5802 | {return long(fetch_xor(__v) ^ __v);} |
| 5803 | } atomic_long; |
| 5804 | |
| 5805 | inline _LIBCPP_INLINE_VISIBILITY |
| 5806 | bool |
| 5807 | atomic_is_lock_free(const volatile atomic_long*) |
| 5808 | { |
| 5809 | typedef long type; |
| 5810 | return __atomic_is_lock_free(type); |
| 5811 | } |
| 5812 | |
| 5813 | inline _LIBCPP_INLINE_VISIBILITY |
| 5814 | bool |
| 5815 | atomic_is_lock_free(const atomic_long* __obj) |
| 5816 | { |
| 5817 | return atomic_is_lock_free(const_cast<volatile atomic_long*>(__obj)); |
| 5818 | } |
| 5819 | |
| 5820 | inline _LIBCPP_INLINE_VISIBILITY |
| 5821 | void |
| 5822 | atomic_init(volatile atomic_long* __obj, long __desr) |
| 5823 | { |
| 5824 | __obj->__v_ = __desr; |
| 5825 | } |
| 5826 | |
| 5827 | inline _LIBCPP_INLINE_VISIBILITY |
| 5828 | void |
| 5829 | atomic_init(atomic_long* __obj, long __desr) |
| 5830 | { |
| 5831 | __obj->__v_ = __desr; |
| 5832 | } |
| 5833 | |
| 5834 | inline _LIBCPP_INLINE_VISIBILITY |
| 5835 | void |
| 5836 | atomic_store(volatile atomic_long* __obj, long __desr) |
| 5837 | { |
| 5838 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 5839 | } |
| 5840 | |
| 5841 | inline _LIBCPP_INLINE_VISIBILITY |
| 5842 | void |
| 5843 | atomic_store(atomic_long* __obj, long __desr) |
| 5844 | { |
| 5845 | atomic_store(const_cast<volatile atomic_long*>(__obj), __desr); |
| 5846 | } |
| 5847 | |
| 5848 | inline _LIBCPP_INLINE_VISIBILITY |
| 5849 | void |
| 5850 | atomic_store_explicit(volatile atomic_long* __obj, long __desr, |
| 5851 | memory_order __o) |
| 5852 | { |
| 5853 | __atomic_store(&__obj->__v_, __desr, __o); |
| 5854 | } |
| 5855 | |
| 5856 | inline _LIBCPP_INLINE_VISIBILITY |
| 5857 | void |
| 5858 | atomic_store_explicit(atomic_long* __obj, long __desr, memory_order __o) |
| 5859 | { |
| 5860 | atomic_store_explicit(const_cast<volatile atomic_long*>(__obj), __desr, |
| 5861 | __o); |
| 5862 | } |
| 5863 | |
| 5864 | inline _LIBCPP_INLINE_VISIBILITY |
| 5865 | long |
| 5866 | atomic_load(const volatile atomic_long* __obj) |
| 5867 | { |
| 5868 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 5869 | } |
| 5870 | |
| 5871 | inline _LIBCPP_INLINE_VISIBILITY |
| 5872 | long |
| 5873 | atomic_load(const atomic_long* __obj) |
| 5874 | { |
| 5875 | return atomic_load(const_cast<const volatile atomic_long*>(__obj)); |
| 5876 | } |
| 5877 | |
| 5878 | inline _LIBCPP_INLINE_VISIBILITY |
| 5879 | long |
| 5880 | atomic_load_explicit(const volatile atomic_long* __obj, memory_order __o) |
| 5881 | { |
| 5882 | return __atomic_load(&__obj->__v_, __o); |
| 5883 | } |
| 5884 | |
| 5885 | inline _LIBCPP_INLINE_VISIBILITY |
| 5886 | long |
| 5887 | atomic_load_explicit(const atomic_long* __obj, memory_order __o) |
| 5888 | { |
| 5889 | return atomic_load_explicit(const_cast<const volatile atomic_long*> |
| 5890 | (__obj), __o); |
| 5891 | } |
| 5892 | |
| 5893 | inline _LIBCPP_INLINE_VISIBILITY |
| 5894 | long |
| 5895 | atomic_exchange(volatile atomic_long* __obj, long __desr) |
| 5896 | { |
| 5897 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 5898 | } |
| 5899 | |
| 5900 | inline _LIBCPP_INLINE_VISIBILITY |
| 5901 | long |
| 5902 | atomic_exchange(atomic_long* __obj, long __desr) |
| 5903 | { |
| 5904 | return atomic_exchange(const_cast<volatile atomic_long*>(__obj), __desr); |
| 5905 | } |
| 5906 | |
| 5907 | inline _LIBCPP_INLINE_VISIBILITY |
| 5908 | long |
| 5909 | atomic_exchange_explicit(volatile atomic_long* __obj, long __desr, |
| 5910 | memory_order __o) |
| 5911 | { |
| 5912 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 5913 | } |
| 5914 | |
| 5915 | inline _LIBCPP_INLINE_VISIBILITY |
| 5916 | long |
| 5917 | atomic_exchange_explicit(atomic_long* __obj, long __desr, memory_order __o) |
| 5918 | { |
| 5919 | return atomic_exchange_explicit(const_cast<volatile atomic_long*> |
| 5920 | (__obj), __desr, __o); |
| 5921 | } |
| 5922 | |
| 5923 | inline _LIBCPP_INLINE_VISIBILITY |
| 5924 | bool |
| 5925 | atomic_compare_exchange_weak(volatile atomic_long* __obj, long* __exp, |
| 5926 | long __desr) |
| 5927 | { |
| 5928 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 5929 | memory_order_seq_cst, memory_order_seq_cst); |
| 5930 | } |
| 5931 | |
| 5932 | inline _LIBCPP_INLINE_VISIBILITY |
| 5933 | bool |
| 5934 | atomic_compare_exchange_weak(atomic_long* __obj, long* __exp, long __desr) |
| 5935 | { |
| 5936 | return atomic_compare_exchange_weak(const_cast<volatile atomic_long*> |
| 5937 | (__obj), __exp, __desr); |
| 5938 | } |
| 5939 | |
| 5940 | inline _LIBCPP_INLINE_VISIBILITY |
| 5941 | bool |
| 5942 | atomic_compare_exchange_strong(volatile atomic_long* __obj, long* __exp, |
| 5943 | long __desr) |
| 5944 | { |
| 5945 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 5946 | memory_order_seq_cst, memory_order_seq_cst); |
| 5947 | } |
| 5948 | |
| 5949 | inline _LIBCPP_INLINE_VISIBILITY |
| 5950 | bool |
| 5951 | atomic_compare_exchange_strong(atomic_long* __obj, long* __exp, long __desr) |
| 5952 | { |
| 5953 | return atomic_compare_exchange_strong(const_cast<volatile atomic_long*> |
| 5954 | (__obj), __exp, __desr); |
| 5955 | } |
| 5956 | |
| 5957 | inline _LIBCPP_INLINE_VISIBILITY |
| 5958 | bool |
| 5959 | atomic_compare_exchange_weak_explicit(volatile atomic_long* __obj, long* __exp, |
| 5960 | long __desr, memory_order __s, |
| 5961 | memory_order __f) |
| 5962 | { |
| 5963 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 5964 | __f); |
| 5965 | } |
| 5966 | |
| 5967 | inline _LIBCPP_INLINE_VISIBILITY |
| 5968 | bool |
| 5969 | atomic_compare_exchange_weak_explicit(atomic_long* __obj, long* __exp, |
| 5970 | long __desr, memory_order __s, |
| 5971 | memory_order __f) |
| 5972 | { |
| 5973 | return atomic_compare_exchange_weak_explicit( |
| 5974 | const_cast<volatile atomic_long*>(__obj), __exp, __desr, __s, __f); |
| 5975 | } |
| 5976 | |
| 5977 | inline _LIBCPP_INLINE_VISIBILITY |
| 5978 | bool |
| 5979 | atomic_compare_exchange_strong_explicit(volatile atomic_long* __obj, |
| 5980 | long* __exp, long __desr, |
| 5981 | memory_order __s, memory_order __f) |
| 5982 | { |
| 5983 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 5984 | __f); |
| 5985 | } |
| 5986 | |
| 5987 | inline _LIBCPP_INLINE_VISIBILITY |
| 5988 | bool |
| 5989 | atomic_compare_exchange_strong_explicit(atomic_long* __obj, long* __exp, |
| 5990 | long __desr, memory_order __s, |
| 5991 | memory_order __f) |
| 5992 | { |
| 5993 | return atomic_compare_exchange_strong_explicit( |
| 5994 | const_cast<volatile atomic_long*>(__obj), __exp, __desr, __s, __f); |
| 5995 | } |
| 5996 | |
| 5997 | inline _LIBCPP_INLINE_VISIBILITY |
| 5998 | long |
| 5999 | atomic_fetch_add(volatile atomic_long* __obj, long __v) |
| 6000 | { |
| 6001 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 6002 | } |
| 6003 | |
| 6004 | inline _LIBCPP_INLINE_VISIBILITY |
| 6005 | long |
| 6006 | atomic_fetch_add(atomic_long* __obj, long __v) |
| 6007 | { |
| 6008 | return atomic_fetch_add(const_cast<volatile atomic_long*>(__obj), __v); |
| 6009 | } |
| 6010 | |
| 6011 | inline _LIBCPP_INLINE_VISIBILITY |
| 6012 | long |
| 6013 | atomic_fetch_add_explicit(volatile atomic_long* __obj, long __v, |
| 6014 | memory_order __o) |
| 6015 | { |
| 6016 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 6017 | } |
| 6018 | |
| 6019 | inline _LIBCPP_INLINE_VISIBILITY |
| 6020 | long |
| 6021 | atomic_fetch_add_explicit(atomic_long* __obj, long __v, memory_order __o) |
| 6022 | { |
| 6023 | return atomic_fetch_add_explicit(const_cast<volatile atomic_long*>(__obj), |
| 6024 | __v, __o); |
| 6025 | } |
| 6026 | |
| 6027 | inline _LIBCPP_INLINE_VISIBILITY |
| 6028 | long |
| 6029 | atomic_fetch_sub(volatile atomic_long* __obj, long __v) |
| 6030 | { |
| 6031 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 6032 | } |
| 6033 | |
| 6034 | inline _LIBCPP_INLINE_VISIBILITY |
| 6035 | long |
| 6036 | atomic_fetch_sub(atomic_long* __obj, long __v) |
| 6037 | { |
| 6038 | return atomic_fetch_sub(const_cast<volatile atomic_long*>(__obj), __v); |
| 6039 | } |
| 6040 | |
| 6041 | inline _LIBCPP_INLINE_VISIBILITY |
| 6042 | long |
| 6043 | atomic_fetch_sub_explicit(volatile atomic_long* __obj, long __v, |
| 6044 | memory_order __o) |
| 6045 | { |
| 6046 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 6047 | } |
| 6048 | |
| 6049 | inline _LIBCPP_INLINE_VISIBILITY |
| 6050 | long |
| 6051 | atomic_fetch_sub_explicit(atomic_long* __obj, long __v, memory_order __o) |
| 6052 | { |
| 6053 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_long*>(__obj), |
| 6054 | __v, __o); |
| 6055 | } |
| 6056 | |
| 6057 | inline _LIBCPP_INLINE_VISIBILITY |
| 6058 | long |
| 6059 | atomic_fetch_and(volatile atomic_long* __obj, long __v) |
| 6060 | { |
| 6061 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 6062 | } |
| 6063 | |
| 6064 | inline _LIBCPP_INLINE_VISIBILITY |
| 6065 | long |
| 6066 | atomic_fetch_and(atomic_long* __obj, long __v) |
| 6067 | { |
| 6068 | return atomic_fetch_and(const_cast<volatile atomic_long*>(__obj), __v); |
| 6069 | } |
| 6070 | |
| 6071 | inline _LIBCPP_INLINE_VISIBILITY |
| 6072 | long |
| 6073 | atomic_fetch_and_explicit(volatile atomic_long* __obj, long __v, |
| 6074 | memory_order __o) |
| 6075 | { |
| 6076 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 6077 | } |
| 6078 | |
| 6079 | inline _LIBCPP_INLINE_VISIBILITY |
| 6080 | long |
| 6081 | atomic_fetch_and_explicit(atomic_long* __obj, long __v, memory_order __o) |
| 6082 | { |
| 6083 | return atomic_fetch_and_explicit(const_cast<volatile atomic_long*>(__obj), |
| 6084 | __v, __o); |
| 6085 | } |
| 6086 | |
| 6087 | inline _LIBCPP_INLINE_VISIBILITY |
| 6088 | long |
| 6089 | atomic_fetch_or(volatile atomic_long* __obj, long __v) |
| 6090 | { |
| 6091 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 6092 | } |
| 6093 | |
| 6094 | inline _LIBCPP_INLINE_VISIBILITY |
| 6095 | long |
| 6096 | atomic_fetch_or(atomic_long* __obj, long __v) |
| 6097 | { |
| 6098 | return atomic_fetch_or(const_cast<volatile atomic_long*>(__obj), __v); |
| 6099 | } |
| 6100 | |
| 6101 | inline _LIBCPP_INLINE_VISIBILITY |
| 6102 | long |
| 6103 | atomic_fetch_or_explicit(volatile atomic_long* __obj, long __v, |
| 6104 | memory_order __o) |
| 6105 | { |
| 6106 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 6107 | } |
| 6108 | |
| 6109 | inline _LIBCPP_INLINE_VISIBILITY |
| 6110 | long |
| 6111 | atomic_fetch_or_explicit(atomic_long* __obj, long __v, memory_order __o) |
| 6112 | { |
| 6113 | return atomic_fetch_or_explicit(const_cast<volatile atomic_long*>(__obj), |
| 6114 | __v, __o); |
| 6115 | } |
| 6116 | |
| 6117 | inline _LIBCPP_INLINE_VISIBILITY |
| 6118 | long |
| 6119 | atomic_fetch_xor(volatile atomic_long* __obj, long __v) |
| 6120 | { |
| 6121 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 6122 | } |
| 6123 | |
| 6124 | inline _LIBCPP_INLINE_VISIBILITY |
| 6125 | long |
| 6126 | atomic_fetch_xor(atomic_long* __obj, long __v) |
| 6127 | { |
| 6128 | return atomic_fetch_xor(const_cast<volatile atomic_long*>(__obj), __v); |
| 6129 | } |
| 6130 | |
| 6131 | inline _LIBCPP_INLINE_VISIBILITY |
| 6132 | long |
| 6133 | atomic_fetch_xor_explicit(volatile atomic_long* __obj, long __v, |
| 6134 | memory_order __o) |
| 6135 | { |
| 6136 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 6137 | } |
| 6138 | |
| 6139 | inline _LIBCPP_INLINE_VISIBILITY |
| 6140 | long |
| 6141 | atomic_fetch_xor_explicit(atomic_long* __obj, long __v, memory_order __o) |
| 6142 | { |
| 6143 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_long*>(__obj), |
| 6144 | __v, __o); |
| 6145 | } |
| 6146 | |
| 6147 | // atomic_ulong |
| 6148 | |
| 6149 | struct atomic_ulong; |
| 6150 | |
| 6151 | bool atomic_is_lock_free(const volatile atomic_ulong*); |
| 6152 | bool atomic_is_lock_free(const atomic_ulong*); |
| 6153 | void atomic_init(volatile atomic_ulong*, unsigned long); |
| 6154 | void atomic_init(atomic_ulong*, unsigned long); |
| 6155 | void atomic_store(volatile atomic_ulong*, unsigned long); |
| 6156 | void atomic_store(atomic_ulong*, unsigned long); |
| 6157 | void atomic_store_explicit(volatile atomic_ulong*, unsigned long, memory_order); |
| 6158 | void atomic_store_explicit(atomic_ulong*, unsigned long, memory_order); |
| 6159 | unsigned long atomic_load(const volatile atomic_ulong*); |
| 6160 | unsigned long atomic_load(const atomic_ulong*); |
| 6161 | unsigned long atomic_load_explicit(const volatile atomic_ulong*, memory_order); |
| 6162 | unsigned long atomic_load_explicit(const atomic_ulong*, memory_order); |
| 6163 | unsigned long atomic_exchange(volatile atomic_ulong*, unsigned long); |
| 6164 | unsigned long atomic_exchange(atomic_ulong*, unsigned long); |
| 6165 | unsigned long atomic_exchange_explicit(volatile atomic_ulong*, unsigned long, |
| 6166 | memory_order); |
| 6167 | unsigned long atomic_exchange_explicit(atomic_ulong*, unsigned long, |
| 6168 | memory_order); |
| 6169 | bool atomic_compare_exchange_weak(volatile atomic_ulong*, unsigned long*, |
| 6170 | unsigned long); |
| 6171 | bool atomic_compare_exchange_weak(atomic_ulong*, unsigned long*, unsigned long); |
| 6172 | bool atomic_compare_exchange_strong(volatile atomic_ulong*, unsigned long*, |
| 6173 | unsigned long); |
| 6174 | bool atomic_compare_exchange_strong(atomic_ulong*, unsigned long*, |
| 6175 | unsigned long); |
| 6176 | bool atomic_compare_exchange_weak_explicit(volatile atomic_ulong*, |
| 6177 | unsigned long*, unsigned long, |
| 6178 | memory_order, memory_order); |
| 6179 | bool atomic_compare_exchange_weak_explicit(atomic_ulong*, unsigned long*, |
| 6180 | unsigned long, memory_order, |
| 6181 | memory_order); |
| 6182 | bool atomic_compare_exchange_strong_explicit(volatile atomic_ulong*, |
| 6183 | unsigned long*, unsigned long, |
| 6184 | memory_order, memory_order); |
| 6185 | bool atomic_compare_exchange_strong_explicit(atomic_ulong*, unsigned long*, |
| 6186 | unsigned long, memory_order, |
| 6187 | memory_order); |
| 6188 | unsigned long atomic_fetch_add(volatile atomic_ulong*, unsigned long); |
| 6189 | unsigned long atomic_fetch_add(atomic_ulong*, unsigned long); |
| 6190 | unsigned long atomic_fetch_add_explicit(volatile atomic_ulong*, unsigned long, |
| 6191 | memory_order); |
| 6192 | unsigned long atomic_fetch_add_explicit(atomic_ulong*, unsigned long, |
| 6193 | memory_order); |
| 6194 | unsigned long atomic_fetch_sub(volatile atomic_ulong*, unsigned long); |
| 6195 | unsigned long atomic_fetch_sub(atomic_ulong*, unsigned long); |
| 6196 | unsigned long atomic_fetch_sub_explicit(volatile atomic_ulong*, unsigned long, |
| 6197 | memory_order); |
| 6198 | unsigned long atomic_fetch_sub_explicit(atomic_ulong*, unsigned long, |
| 6199 | memory_order); |
| 6200 | unsigned long atomic_fetch_and(volatile atomic_ulong*, unsigned long); |
| 6201 | unsigned long atomic_fetch_and(atomic_ulong*, unsigned long); |
| 6202 | unsigned long atomic_fetch_and_explicit(volatile atomic_ulong*, unsigned long, |
| 6203 | memory_order); |
| 6204 | unsigned long atomic_fetch_and_explicit(atomic_ulong*, unsigned long, |
| 6205 | memory_order); |
| 6206 | unsigned long atomic_fetch_or(volatile atomic_ulong*, unsigned long); |
| 6207 | unsigned long atomic_fetch_or(atomic_ulong*, unsigned long); |
| 6208 | unsigned long atomic_fetch_or_explicit(volatile atomic_ulong*, unsigned long, |
| 6209 | memory_order); |
| 6210 | unsigned long atomic_fetch_or_explicit(atomic_ulong*, unsigned long, |
| 6211 | memory_order); |
| 6212 | unsigned long atomic_fetch_xor(volatile atomic_ulong*, unsigned long); |
| 6213 | unsigned long atomic_fetch_xor(atomic_ulong*, unsigned long); |
| 6214 | unsigned long atomic_fetch_xor_explicit(volatile atomic_ulong*, unsigned long, |
| 6215 | memory_order); |
| 6216 | unsigned long atomic_fetch_xor_explicit(atomic_ulong*, unsigned long, |
| 6217 | memory_order); |
| 6218 | |
| 6219 | typedef struct atomic_ulong |
| 6220 | { |
| 6221 | unsigned long __v_; |
| 6222 | |
| 6223 | _LIBCPP_INLINE_VISIBILITY |
| 6224 | bool is_lock_free() const volatile |
| 6225 | {return atomic_is_lock_free(this);} |
| 6226 | _LIBCPP_INLINE_VISIBILITY |
| 6227 | bool is_lock_free() const |
| 6228 | {return atomic_is_lock_free(this);} |
| 6229 | _LIBCPP_INLINE_VISIBILITY |
| 6230 | void store(unsigned long __v, |
| 6231 | memory_order __o = memory_order_seq_cst) volatile |
| 6232 | {atomic_store_explicit(this, __v, __o);} |
| 6233 | _LIBCPP_INLINE_VISIBILITY |
| 6234 | void store(unsigned long __v, memory_order __o = memory_order_seq_cst) |
| 6235 | {atomic_store_explicit(this, __v, __o);} |
| 6236 | _LIBCPP_INLINE_VISIBILITY |
| 6237 | unsigned long load(memory_order __o = memory_order_seq_cst) const volatile |
| 6238 | {return atomic_load_explicit(this, __o);} |
| 6239 | _LIBCPP_INLINE_VISIBILITY |
| 6240 | unsigned long load(memory_order __o = memory_order_seq_cst) const |
| 6241 | {return atomic_load_explicit(this, __o);} |
| 6242 | _LIBCPP_INLINE_VISIBILITY |
| 6243 | operator unsigned long() const volatile |
| 6244 | {return load();} |
| 6245 | _LIBCPP_INLINE_VISIBILITY |
| 6246 | operator unsigned long() const |
| 6247 | {return load();} |
| 6248 | _LIBCPP_INLINE_VISIBILITY |
| 6249 | unsigned long exchange(unsigned long __v, |
| 6250 | memory_order __o = memory_order_seq_cst) volatile |
| 6251 | {return atomic_exchange_explicit(this, __v, __o);} |
| 6252 | _LIBCPP_INLINE_VISIBILITY |
| 6253 | unsigned long exchange(unsigned long __v, |
| 6254 | memory_order __o = memory_order_seq_cst) |
| 6255 | {return atomic_exchange_explicit(this, __v, __o);} |
| 6256 | _LIBCPP_INLINE_VISIBILITY |
| 6257 | bool compare_exchange_weak(unsigned long& __v, unsigned long __e, |
| 6258 | memory_order __s, memory_order __f) volatile |
| 6259 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 6260 | __f);} |
| 6261 | _LIBCPP_INLINE_VISIBILITY |
| 6262 | bool compare_exchange_weak(unsigned long& __v, unsigned long __e, |
| 6263 | memory_order __s, memory_order __f) |
| 6264 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 6265 | __f);} |
| 6266 | _LIBCPP_INLINE_VISIBILITY |
| 6267 | bool compare_exchange_strong(unsigned long& __v, unsigned long __e, |
| 6268 | memory_order __s, memory_order __f) volatile |
| 6269 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 6270 | __f);} |
| 6271 | _LIBCPP_INLINE_VISIBILITY |
| 6272 | bool compare_exchange_strong(unsigned long& __v, unsigned long __e, |
| 6273 | memory_order __s, memory_order __f) |
| 6274 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 6275 | __f);} |
| 6276 | _LIBCPP_INLINE_VISIBILITY |
| 6277 | bool compare_exchange_weak(unsigned long& __v, unsigned long __e, |
| 6278 | memory_order __s = memory_order_seq_cst) volatile |
| 6279 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 6280 | __translate_memory_order(__s));} |
| 6281 | _LIBCPP_INLINE_VISIBILITY |
| 6282 | bool compare_exchange_weak(unsigned long& __v, unsigned long __e, |
| 6283 | memory_order __s = memory_order_seq_cst) |
| 6284 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 6285 | __translate_memory_order(__s));} |
| 6286 | _LIBCPP_INLINE_VISIBILITY |
| 6287 | bool compare_exchange_strong(unsigned long& __v, unsigned long __e, |
| 6288 | memory_order __s = memory_order_seq_cst) volatile |
| 6289 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 6290 | __translate_memory_order(__s));} |
| 6291 | _LIBCPP_INLINE_VISIBILITY |
| 6292 | bool compare_exchange_strong(unsigned long& __v, unsigned long __e, |
| 6293 | memory_order __s = memory_order_seq_cst) |
| 6294 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 6295 | __translate_memory_order(__s));} |
| 6296 | _LIBCPP_INLINE_VISIBILITY |
| 6297 | unsigned long fetch_add(unsigned long __v, |
| 6298 | memory_order __o = memory_order_seq_cst) volatile |
| 6299 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 6300 | _LIBCPP_INLINE_VISIBILITY |
| 6301 | unsigned long fetch_add(unsigned long __v, |
| 6302 | memory_order __o = memory_order_seq_cst) |
| 6303 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 6304 | _LIBCPP_INLINE_VISIBILITY |
| 6305 | unsigned long fetch_sub(unsigned long __v, |
| 6306 | memory_order __o = memory_order_seq_cst) volatile |
| 6307 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 6308 | _LIBCPP_INLINE_VISIBILITY |
| 6309 | unsigned long fetch_sub(unsigned long __v, |
| 6310 | memory_order __o = memory_order_seq_cst) |
| 6311 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 6312 | _LIBCPP_INLINE_VISIBILITY |
| 6313 | unsigned long fetch_and(unsigned long __v, |
| 6314 | memory_order __o = memory_order_seq_cst) volatile |
| 6315 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 6316 | _LIBCPP_INLINE_VISIBILITY |
| 6317 | unsigned long fetch_and(unsigned long __v, |
| 6318 | memory_order __o = memory_order_seq_cst) |
| 6319 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 6320 | _LIBCPP_INLINE_VISIBILITY |
| 6321 | unsigned long fetch_or(unsigned long __v, |
| 6322 | memory_order __o = memory_order_seq_cst) volatile |
| 6323 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 6324 | _LIBCPP_INLINE_VISIBILITY |
| 6325 | unsigned long fetch_or(unsigned long __v, |
| 6326 | memory_order __o = memory_order_seq_cst) |
| 6327 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 6328 | _LIBCPP_INLINE_VISIBILITY |
| 6329 | unsigned long fetch_xor(unsigned long __v, |
| 6330 | memory_order __o = memory_order_seq_cst) volatile |
| 6331 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 6332 | _LIBCPP_INLINE_VISIBILITY |
| 6333 | unsigned long fetch_xor(unsigned long __v, |
| 6334 | memory_order __o = memory_order_seq_cst) |
| 6335 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 6336 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 6337 | atomic_ulong() = default; |
| 6338 | #else |
| 6339 | _LIBCPP_INLINE_VISIBILITY |
| 6340 | atomic_ulong() {} |
| 6341 | #endif |
| 6342 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 6343 | constexpr atomic_ulong(unsigned long __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 6344 | : __v_(__v) {} |
| 6345 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 6346 | atomic_ulong(const atomic_ulong&) = delete; |
| 6347 | atomic_ulong& operator=(const atomic_ulong&) = delete; |
| 6348 | atomic_ulong& operator=(const atomic_ulong&) volatile = delete; |
| 6349 | #else |
| 6350 | private: |
| 6351 | atomic_ulong(const atomic_ulong&); |
| 6352 | atomic_ulong& operator=(const atomic_ulong&); |
| 6353 | atomic_ulong& operator=(const atomic_ulong&) volatile; |
| 6354 | public: |
| 6355 | #endif |
| 6356 | _LIBCPP_INLINE_VISIBILITY |
| 6357 | unsigned long operator=(unsigned long __v) volatile |
| 6358 | {store(__v); return __v;} |
| 6359 | _LIBCPP_INLINE_VISIBILITY |
| 6360 | unsigned long operator=(unsigned long __v) |
| 6361 | {store(__v); return __v;} |
| 6362 | _LIBCPP_INLINE_VISIBILITY |
| 6363 | unsigned long operator++(int) volatile |
| 6364 | {typedef unsigned long type; return fetch_add(type(1));} |
| 6365 | _LIBCPP_INLINE_VISIBILITY |
| 6366 | long operator++(int) |
| 6367 | {typedef unsigned long type; return fetch_add(type(1));} |
| 6368 | _LIBCPP_INLINE_VISIBILITY |
| 6369 | long operator--(int) volatile |
| 6370 | {typedef unsigned long type; return fetch_sub(type(1));} |
| 6371 | _LIBCPP_INLINE_VISIBILITY |
| 6372 | long operator--(int) |
| 6373 | {typedef unsigned long type; return fetch_sub(type(1));} |
| 6374 | _LIBCPP_INLINE_VISIBILITY |
| 6375 | long operator++() volatile |
| 6376 | {typedef unsigned long type; return type(fetch_add(type(1)) + 1);} |
| 6377 | _LIBCPP_INLINE_VISIBILITY |
| 6378 | long operator++() |
| 6379 | {typedef unsigned long type; return type(fetch_add(type(1)) + 1);} |
| 6380 | _LIBCPP_INLINE_VISIBILITY |
| 6381 | long operator--() volatile |
| 6382 | {typedef unsigned long type; return type(fetch_sub(type(1)) - 1);} |
| 6383 | _LIBCPP_INLINE_VISIBILITY |
| 6384 | long operator--() |
| 6385 | {typedef unsigned long type; return type(fetch_sub(type(1)) - 1);} |
| 6386 | _LIBCPP_INLINE_VISIBILITY |
| 6387 | long operator+=(long __v) volatile |
| 6388 | {typedef unsigned long type; return type(fetch_add(__v) + __v);} |
| 6389 | _LIBCPP_INLINE_VISIBILITY |
| 6390 | long operator+=(long __v) |
| 6391 | {typedef unsigned long type; return type(fetch_add(__v) + __v);} |
| 6392 | _LIBCPP_INLINE_VISIBILITY |
| 6393 | long operator-=(long __v) volatile |
| 6394 | {typedef unsigned long type; return type(fetch_sub(__v) - __v);} |
| 6395 | _LIBCPP_INLINE_VISIBILITY |
| 6396 | long operator-=(long __v) |
| 6397 | {typedef unsigned long type; return type(fetch_sub(__v) - __v);} |
| 6398 | _LIBCPP_INLINE_VISIBILITY |
| 6399 | long operator&=(long __v) volatile |
| 6400 | {typedef unsigned long type; return type(fetch_and(__v) & __v);} |
| 6401 | _LIBCPP_INLINE_VISIBILITY |
| 6402 | long operator&=(long __v) |
| 6403 | {typedef unsigned long type; return type(fetch_and(__v) & __v);} |
| 6404 | _LIBCPP_INLINE_VISIBILITY |
| 6405 | long operator|=(long __v) volatile |
| 6406 | {typedef unsigned long type; return type(fetch_or(__v) | __v);} |
| 6407 | _LIBCPP_INLINE_VISIBILITY |
| 6408 | long operator|=(long __v) |
| 6409 | {typedef unsigned long type; return type(fetch_or(__v) | __v);} |
| 6410 | _LIBCPP_INLINE_VISIBILITY |
| 6411 | long operator^=(long __v) volatile |
| 6412 | {typedef unsigned long type; return type(fetch_xor(__v) ^ __v);} |
| 6413 | _LIBCPP_INLINE_VISIBILITY |
| 6414 | long operator^=(long __v) |
| 6415 | {typedef unsigned long type; return type(fetch_xor(__v) ^ __v);} |
| 6416 | } atomic_ulong; |
| 6417 | |
| 6418 | inline _LIBCPP_INLINE_VISIBILITY |
| 6419 | bool |
| 6420 | atomic_is_lock_free(const volatile atomic_ulong*) |
| 6421 | { |
| 6422 | typedef unsigned long type; |
| 6423 | return __atomic_is_lock_free(type); |
| 6424 | } |
| 6425 | |
| 6426 | inline _LIBCPP_INLINE_VISIBILITY |
| 6427 | bool |
| 6428 | atomic_is_lock_free(const atomic_ulong* __obj) |
| 6429 | { |
| 6430 | return atomic_is_lock_free(const_cast<volatile atomic_ulong*>(__obj)); |
| 6431 | } |
| 6432 | |
| 6433 | inline _LIBCPP_INLINE_VISIBILITY |
| 6434 | void |
| 6435 | atomic_init(volatile atomic_ulong* __obj, unsigned long __desr) |
| 6436 | { |
| 6437 | __obj->__v_ = __desr; |
| 6438 | } |
| 6439 | |
| 6440 | inline _LIBCPP_INLINE_VISIBILITY |
| 6441 | void |
| 6442 | atomic_init(atomic_ulong* __obj, unsigned long __desr) |
| 6443 | { |
| 6444 | __obj->__v_ = __desr; |
| 6445 | } |
| 6446 | |
| 6447 | inline _LIBCPP_INLINE_VISIBILITY |
| 6448 | void |
| 6449 | atomic_store(volatile atomic_ulong* __obj, unsigned long __desr) |
| 6450 | { |
| 6451 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 6452 | } |
| 6453 | |
| 6454 | inline _LIBCPP_INLINE_VISIBILITY |
| 6455 | void |
| 6456 | atomic_store(atomic_ulong* __obj, unsigned long __desr) |
| 6457 | { |
| 6458 | atomic_store(const_cast<volatile atomic_ulong*>(__obj), __desr); |
| 6459 | } |
| 6460 | |
| 6461 | inline _LIBCPP_INLINE_VISIBILITY |
| 6462 | void |
| 6463 | atomic_store_explicit(volatile atomic_ulong* __obj, unsigned long __desr, |
| 6464 | memory_order __o) |
| 6465 | { |
| 6466 | __atomic_store(&__obj->__v_, __desr, __o); |
| 6467 | } |
| 6468 | |
| 6469 | inline _LIBCPP_INLINE_VISIBILITY |
| 6470 | void |
| 6471 | atomic_store_explicit(atomic_ulong* __obj, unsigned long __desr, |
| 6472 | memory_order __o) |
| 6473 | { |
| 6474 | atomic_store_explicit(const_cast<volatile atomic_ulong*>(__obj), __desr, |
| 6475 | __o); |
| 6476 | } |
| 6477 | |
| 6478 | inline _LIBCPP_INLINE_VISIBILITY |
| 6479 | unsigned long |
| 6480 | atomic_load(const volatile atomic_ulong* __obj) |
| 6481 | { |
| 6482 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 6483 | } |
| 6484 | |
| 6485 | inline _LIBCPP_INLINE_VISIBILITY |
| 6486 | unsigned long |
| 6487 | atomic_load(const atomic_ulong* __obj) |
| 6488 | { |
| 6489 | return atomic_load(const_cast<const volatile atomic_ulong*>(__obj)); |
| 6490 | } |
| 6491 | |
| 6492 | inline _LIBCPP_INLINE_VISIBILITY |
| 6493 | unsigned long |
| 6494 | atomic_load_explicit(const volatile atomic_ulong* __obj, memory_order __o) |
| 6495 | { |
| 6496 | return __atomic_load(&__obj->__v_, __o); |
| 6497 | } |
| 6498 | |
| 6499 | inline _LIBCPP_INLINE_VISIBILITY |
| 6500 | unsigned long |
| 6501 | atomic_load_explicit(const atomic_ulong* __obj, memory_order __o) |
| 6502 | { |
| 6503 | return atomic_load_explicit(const_cast<const volatile atomic_ulong*> |
| 6504 | (__obj), __o); |
| 6505 | } |
| 6506 | |
| 6507 | inline _LIBCPP_INLINE_VISIBILITY |
| 6508 | unsigned long |
| 6509 | atomic_exchange(volatile atomic_ulong* __obj, unsigned long __desr) |
| 6510 | { |
| 6511 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 6512 | } |
| 6513 | |
| 6514 | inline _LIBCPP_INLINE_VISIBILITY |
| 6515 | unsigned long |
| 6516 | atomic_exchange(atomic_ulong* __obj, unsigned long __desr) |
| 6517 | { |
| 6518 | return atomic_exchange(const_cast<volatile atomic_ulong*>(__obj), __desr); |
| 6519 | } |
| 6520 | |
| 6521 | inline _LIBCPP_INLINE_VISIBILITY |
| 6522 | unsigned long |
| 6523 | atomic_exchange_explicit(volatile atomic_ulong* __obj, unsigned long __desr, |
| 6524 | memory_order __o) |
| 6525 | { |
| 6526 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 6527 | } |
| 6528 | |
| 6529 | inline _LIBCPP_INLINE_VISIBILITY |
| 6530 | unsigned long |
| 6531 | atomic_exchange_explicit(atomic_ulong* __obj, unsigned long __desr, |
| 6532 | memory_order __o) |
| 6533 | { |
| 6534 | return atomic_exchange_explicit(const_cast<volatile atomic_ulong*> |
| 6535 | (__obj), __desr, __o); |
| 6536 | } |
| 6537 | |
| 6538 | inline _LIBCPP_INLINE_VISIBILITY |
| 6539 | bool |
| 6540 | atomic_compare_exchange_weak(volatile atomic_ulong* __obj, unsigned long* __exp, |
| 6541 | unsigned long __desr) |
| 6542 | { |
| 6543 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 6544 | memory_order_seq_cst, memory_order_seq_cst); |
| 6545 | } |
| 6546 | |
| 6547 | inline _LIBCPP_INLINE_VISIBILITY |
| 6548 | bool |
| 6549 | atomic_compare_exchange_weak(atomic_ulong* __obj, unsigned long* __exp, |
| 6550 | unsigned long __desr) |
| 6551 | { |
| 6552 | return atomic_compare_exchange_weak(const_cast<volatile atomic_ulong*> |
| 6553 | (__obj), __exp, __desr); |
| 6554 | } |
| 6555 | |
| 6556 | inline _LIBCPP_INLINE_VISIBILITY |
| 6557 | bool |
| 6558 | atomic_compare_exchange_strong(volatile atomic_ulong* __obj, |
| 6559 | unsigned long* __exp, unsigned long __desr) |
| 6560 | { |
| 6561 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 6562 | memory_order_seq_cst, memory_order_seq_cst); |
| 6563 | } |
| 6564 | |
| 6565 | inline _LIBCPP_INLINE_VISIBILITY |
| 6566 | bool |
| 6567 | atomic_compare_exchange_strong(atomic_ulong* __obj, unsigned long* __exp, |
| 6568 | unsigned long __desr) |
| 6569 | { |
| 6570 | return atomic_compare_exchange_strong(const_cast<volatile atomic_ulong*> |
| 6571 | (__obj), __exp, __desr); |
| 6572 | } |
| 6573 | |
| 6574 | inline _LIBCPP_INLINE_VISIBILITY |
| 6575 | bool |
| 6576 | atomic_compare_exchange_weak_explicit(volatile atomic_ulong* __obj, |
| 6577 | unsigned long* __exp, |
| 6578 | unsigned long __desr, memory_order __s, |
| 6579 | memory_order __f) |
| 6580 | { |
| 6581 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 6582 | __f); |
| 6583 | } |
| 6584 | |
| 6585 | inline _LIBCPP_INLINE_VISIBILITY |
| 6586 | bool |
| 6587 | atomic_compare_exchange_weak_explicit(atomic_ulong* __obj, unsigned long* __exp, |
| 6588 | unsigned long __desr, memory_order __s, |
| 6589 | memory_order __f) |
| 6590 | { |
| 6591 | return atomic_compare_exchange_weak_explicit( |
| 6592 | const_cast<volatile atomic_ulong*>(__obj), __exp, __desr, __s, __f); |
| 6593 | } |
| 6594 | |
| 6595 | inline _LIBCPP_INLINE_VISIBILITY |
| 6596 | bool |
| 6597 | atomic_compare_exchange_strong_explicit(volatile atomic_ulong* __obj, |
| 6598 | unsigned long* __exp, |
| 6599 | unsigned long __desr, memory_order __s, |
| 6600 | memory_order __f) |
| 6601 | { |
| 6602 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 6603 | __f); |
| 6604 | } |
| 6605 | |
| 6606 | inline _LIBCPP_INLINE_VISIBILITY |
| 6607 | bool |
| 6608 | atomic_compare_exchange_strong_explicit(atomic_ulong* __obj, |
| 6609 | unsigned long* __exp, |
| 6610 | unsigned long __desr, memory_order __s, |
| 6611 | memory_order __f) |
| 6612 | { |
| 6613 | return atomic_compare_exchange_strong_explicit( |
| 6614 | const_cast<volatile atomic_ulong*>(__obj), __exp, __desr, __s, __f); |
| 6615 | } |
| 6616 | |
| 6617 | inline _LIBCPP_INLINE_VISIBILITY |
| 6618 | unsigned long |
| 6619 | atomic_fetch_add(volatile atomic_ulong* __obj, unsigned long __v) |
| 6620 | { |
| 6621 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 6622 | } |
| 6623 | |
| 6624 | inline _LIBCPP_INLINE_VISIBILITY |
| 6625 | unsigned long |
| 6626 | atomic_fetch_add(atomic_ulong* __obj, unsigned long __v) |
| 6627 | { |
| 6628 | return atomic_fetch_add(const_cast<volatile atomic_ulong*>(__obj), __v); |
| 6629 | } |
| 6630 | |
| 6631 | inline _LIBCPP_INLINE_VISIBILITY |
| 6632 | unsigned long |
| 6633 | atomic_fetch_add_explicit(volatile atomic_ulong* __obj, unsigned long __v, |
| 6634 | memory_order __o) |
| 6635 | { |
| 6636 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 6637 | } |
| 6638 | |
| 6639 | inline _LIBCPP_INLINE_VISIBILITY |
| 6640 | unsigned long |
| 6641 | atomic_fetch_add_explicit(atomic_ulong* __obj, unsigned long __v, |
| 6642 | memory_order __o) |
| 6643 | { |
| 6644 | return atomic_fetch_add_explicit(const_cast<volatile atomic_ulong*>(__obj), |
| 6645 | __v, __o); |
| 6646 | } |
| 6647 | |
| 6648 | inline _LIBCPP_INLINE_VISIBILITY |
| 6649 | unsigned long |
| 6650 | atomic_fetch_sub(volatile atomic_ulong* __obj, unsigned long __v) |
| 6651 | { |
| 6652 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 6653 | } |
| 6654 | |
| 6655 | inline _LIBCPP_INLINE_VISIBILITY |
| 6656 | unsigned long |
| 6657 | atomic_fetch_sub(atomic_ulong* __obj, unsigned long __v) |
| 6658 | { |
| 6659 | return atomic_fetch_sub(const_cast<volatile atomic_ulong*>(__obj), __v); |
| 6660 | } |
| 6661 | |
| 6662 | inline _LIBCPP_INLINE_VISIBILITY |
| 6663 | unsigned long |
| 6664 | atomic_fetch_sub_explicit(volatile atomic_ulong* __obj, unsigned long __v, |
| 6665 | memory_order __o) |
| 6666 | { |
| 6667 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 6668 | } |
| 6669 | |
| 6670 | inline _LIBCPP_INLINE_VISIBILITY |
| 6671 | unsigned long |
| 6672 | atomic_fetch_sub_explicit(atomic_ulong* __obj, unsigned long __v, |
| 6673 | memory_order __o) |
| 6674 | { |
| 6675 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_ulong*>(__obj), |
| 6676 | __v, __o); |
| 6677 | } |
| 6678 | |
| 6679 | inline _LIBCPP_INLINE_VISIBILITY |
| 6680 | unsigned long |
| 6681 | atomic_fetch_and(volatile atomic_ulong* __obj, unsigned long __v) |
| 6682 | { |
| 6683 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 6684 | } |
| 6685 | |
| 6686 | inline _LIBCPP_INLINE_VISIBILITY |
| 6687 | unsigned long |
| 6688 | atomic_fetch_and(atomic_ulong* __obj, unsigned long __v) |
| 6689 | { |
| 6690 | return atomic_fetch_and(const_cast<volatile atomic_ulong*>(__obj), __v); |
| 6691 | } |
| 6692 | |
| 6693 | inline _LIBCPP_INLINE_VISIBILITY |
| 6694 | unsigned long |
| 6695 | atomic_fetch_and_explicit(volatile atomic_ulong* __obj, unsigned long __v, |
| 6696 | memory_order __o) |
| 6697 | { |
| 6698 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 6699 | } |
| 6700 | |
| 6701 | inline _LIBCPP_INLINE_VISIBILITY |
| 6702 | unsigned long |
| 6703 | atomic_fetch_and_explicit(atomic_ulong* __obj, unsigned long __v, |
| 6704 | memory_order __o) |
| 6705 | { |
| 6706 | return atomic_fetch_and_explicit(const_cast<volatile atomic_ulong*>(__obj), |
| 6707 | __v, __o); |
| 6708 | } |
| 6709 | |
| 6710 | inline _LIBCPP_INLINE_VISIBILITY |
| 6711 | unsigned long |
| 6712 | atomic_fetch_or(volatile atomic_ulong* __obj, unsigned long __v) |
| 6713 | { |
| 6714 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 6715 | } |
| 6716 | |
| 6717 | inline _LIBCPP_INLINE_VISIBILITY |
| 6718 | unsigned long |
| 6719 | atomic_fetch_or(atomic_ulong* __obj, unsigned long __v) |
| 6720 | { |
| 6721 | return atomic_fetch_or(const_cast<volatile atomic_ulong*>(__obj), __v); |
| 6722 | } |
| 6723 | |
| 6724 | inline _LIBCPP_INLINE_VISIBILITY |
| 6725 | unsigned long |
| 6726 | atomic_fetch_or_explicit(volatile atomic_ulong* __obj, unsigned long __v, |
| 6727 | memory_order __o) |
| 6728 | { |
| 6729 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 6730 | } |
| 6731 | |
| 6732 | inline _LIBCPP_INLINE_VISIBILITY |
| 6733 | unsigned long |
| 6734 | atomic_fetch_or_explicit(atomic_ulong* __obj, unsigned long __v, |
| 6735 | memory_order __o) |
| 6736 | { |
| 6737 | return atomic_fetch_or_explicit(const_cast<volatile atomic_ulong*>(__obj), |
| 6738 | __v, __o); |
| 6739 | } |
| 6740 | |
| 6741 | inline _LIBCPP_INLINE_VISIBILITY |
| 6742 | unsigned long |
| 6743 | atomic_fetch_xor(volatile atomic_ulong* __obj, unsigned long __v) |
| 6744 | { |
| 6745 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 6746 | } |
| 6747 | |
| 6748 | inline _LIBCPP_INLINE_VISIBILITY |
| 6749 | unsigned long |
| 6750 | atomic_fetch_xor(atomic_ulong* __obj, unsigned long __v) |
| 6751 | { |
| 6752 | return atomic_fetch_xor(const_cast<volatile atomic_ulong*>(__obj), __v); |
| 6753 | } |
| 6754 | |
| 6755 | inline _LIBCPP_INLINE_VISIBILITY |
| 6756 | unsigned long |
| 6757 | atomic_fetch_xor_explicit(volatile atomic_ulong* __obj, unsigned long __v, |
| 6758 | memory_order __o) |
| 6759 | { |
| 6760 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 6761 | } |
| 6762 | |
| 6763 | inline _LIBCPP_INLINE_VISIBILITY |
| 6764 | unsigned long |
| 6765 | atomic_fetch_xor_explicit(atomic_ulong* __obj, unsigned long __v, |
| 6766 | memory_order __o) |
| 6767 | { |
| 6768 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_ulong*>(__obj), |
| 6769 | __v, __o); |
| 6770 | } |
| 6771 | |
| 6772 | // atomic_llong |
| 6773 | |
| 6774 | struct atomic_llong; |
| 6775 | |
| 6776 | bool atomic_is_lock_free(const volatile atomic_llong*); |
| 6777 | bool atomic_is_lock_free(const atomic_llong*); |
| 6778 | void atomic_init(volatile atomic_llong*, long long); |
| 6779 | void atomic_init(atomic_llong*, long long); |
| 6780 | void atomic_store(volatile atomic_llong*, long long); |
| 6781 | void atomic_store(atomic_llong*, long long); |
| 6782 | void atomic_store_explicit(volatile atomic_llong*, long long, memory_order); |
| 6783 | void atomic_store_explicit(atomic_llong*, long long, memory_order); |
| 6784 | long long atomic_load(const volatile atomic_llong*); |
| 6785 | long long atomic_load(const atomic_llong*); |
| 6786 | long long atomic_load_explicit(const volatile atomic_llong*, memory_order); |
| 6787 | long long atomic_load_explicit(const atomic_llong*, memory_order); |
| 6788 | long long atomic_exchange(volatile atomic_llong*, long long); |
| 6789 | long long atomic_exchange(atomic_llong*, long long); |
| 6790 | long long atomic_exchange_explicit(volatile atomic_llong*, long long, |
| 6791 | memory_order); |
| 6792 | long long atomic_exchange_explicit(atomic_llong*, long long, |
| 6793 | memory_order); |
| 6794 | bool atomic_compare_exchange_weak(volatile atomic_llong*, long long*, |
| 6795 | long long); |
| 6796 | bool atomic_compare_exchange_weak(atomic_llong*, long long*, long long); |
| 6797 | bool atomic_compare_exchange_strong(volatile atomic_llong*, long long*, |
| 6798 | long long); |
| 6799 | bool atomic_compare_exchange_strong(atomic_llong*, long long*, |
| 6800 | long long); |
| 6801 | bool atomic_compare_exchange_weak_explicit(volatile atomic_llong*, |
| 6802 | long long*, long long, |
| 6803 | memory_order, memory_order); |
| 6804 | bool atomic_compare_exchange_weak_explicit(atomic_llong*, long long*, |
| 6805 | long long, memory_order, |
| 6806 | memory_order); |
| 6807 | bool atomic_compare_exchange_strong_explicit(volatile atomic_llong*, |
| 6808 | long long*, long long, |
| 6809 | memory_order, memory_order); |
| 6810 | bool atomic_compare_exchange_strong_explicit(atomic_llong*, long long*, |
| 6811 | long long, memory_order, |
| 6812 | memory_order); |
| 6813 | long long atomic_fetch_add(volatile atomic_llong*, long long); |
| 6814 | long long atomic_fetch_add(atomic_llong*, long long); |
| 6815 | long long atomic_fetch_add_explicit(volatile atomic_llong*, long long, |
| 6816 | memory_order); |
| 6817 | long long atomic_fetch_add_explicit(atomic_llong*, long long, |
| 6818 | memory_order); |
| 6819 | long long atomic_fetch_sub(volatile atomic_llong*, long long); |
| 6820 | long long atomic_fetch_sub(atomic_llong*, long long); |
| 6821 | long long atomic_fetch_sub_explicit(volatile atomic_llong*, long long, |
| 6822 | memory_order); |
| 6823 | long long atomic_fetch_sub_explicit(atomic_llong*, long long, |
| 6824 | memory_order); |
| 6825 | long long atomic_fetch_and(volatile atomic_llong*, long long); |
| 6826 | long long atomic_fetch_and(atomic_llong*, long long); |
| 6827 | long long atomic_fetch_and_explicit(volatile atomic_llong*, long long, |
| 6828 | memory_order); |
| 6829 | long long atomic_fetch_and_explicit(atomic_llong*, long long, |
| 6830 | memory_order); |
| 6831 | long long atomic_fetch_or(volatile atomic_llong*, long long); |
| 6832 | long long atomic_fetch_or(atomic_llong*, long long); |
| 6833 | long long atomic_fetch_or_explicit(volatile atomic_llong*, long long, |
| 6834 | memory_order); |
| 6835 | long long atomic_fetch_or_explicit(atomic_llong*, long long, |
| 6836 | memory_order); |
| 6837 | long long atomic_fetch_xor(volatile atomic_llong*, long long); |
| 6838 | long long atomic_fetch_xor(atomic_llong*, long long); |
| 6839 | long long atomic_fetch_xor_explicit(volatile atomic_llong*, long long, |
| 6840 | memory_order); |
| 6841 | long long atomic_fetch_xor_explicit(atomic_llong*, long long, |
| 6842 | memory_order); |
| 6843 | |
| 6844 | typedef struct atomic_llong |
| 6845 | { |
| 6846 | long long __v_; |
| 6847 | |
| 6848 | _LIBCPP_INLINE_VISIBILITY |
| 6849 | bool is_lock_free() const volatile |
| 6850 | {return atomic_is_lock_free(this);} |
| 6851 | _LIBCPP_INLINE_VISIBILITY |
| 6852 | bool is_lock_free() const |
| 6853 | {return atomic_is_lock_free(this);} |
| 6854 | _LIBCPP_INLINE_VISIBILITY |
| 6855 | void store(long long __v, |
| 6856 | memory_order __o = memory_order_seq_cst) volatile |
| 6857 | {atomic_store_explicit(this, __v, __o);} |
| 6858 | _LIBCPP_INLINE_VISIBILITY |
| 6859 | void store(long long __v, memory_order __o = memory_order_seq_cst) |
| 6860 | {atomic_store_explicit(this, __v, __o);} |
| 6861 | _LIBCPP_INLINE_VISIBILITY |
| 6862 | long long load(memory_order __o = memory_order_seq_cst) const volatile |
| 6863 | {return atomic_load_explicit(this, __o);} |
| 6864 | _LIBCPP_INLINE_VISIBILITY |
| 6865 | long long load(memory_order __o = memory_order_seq_cst) const |
| 6866 | {return atomic_load_explicit(this, __o);} |
| 6867 | _LIBCPP_INLINE_VISIBILITY |
| 6868 | operator long long() const volatile |
| 6869 | {return load();} |
| 6870 | _LIBCPP_INLINE_VISIBILITY |
| 6871 | operator long long() const |
| 6872 | {return load();} |
| 6873 | _LIBCPP_INLINE_VISIBILITY |
| 6874 | long long exchange(long long __v, |
| 6875 | memory_order __o = memory_order_seq_cst) volatile |
| 6876 | {return atomic_exchange_explicit(this, __v, __o);} |
| 6877 | _LIBCPP_INLINE_VISIBILITY |
| 6878 | long long exchange(long long __v, |
| 6879 | memory_order __o = memory_order_seq_cst) |
| 6880 | {return atomic_exchange_explicit(this, __v, __o);} |
| 6881 | _LIBCPP_INLINE_VISIBILITY |
| 6882 | bool compare_exchange_weak(long long& __v, long long __e, |
| 6883 | memory_order __s, memory_order __f) volatile |
| 6884 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 6885 | __f);} |
| 6886 | _LIBCPP_INLINE_VISIBILITY |
| 6887 | bool compare_exchange_weak(long long& __v, long long __e, |
| 6888 | memory_order __s, memory_order __f) |
| 6889 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 6890 | __f);} |
| 6891 | _LIBCPP_INLINE_VISIBILITY |
| 6892 | bool compare_exchange_strong(long long& __v, long long __e, |
| 6893 | memory_order __s, memory_order __f) volatile |
| 6894 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 6895 | __f);} |
| 6896 | _LIBCPP_INLINE_VISIBILITY |
| 6897 | bool compare_exchange_strong(long long& __v, long long __e, |
| 6898 | memory_order __s, memory_order __f) |
| 6899 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 6900 | __f);} |
| 6901 | _LIBCPP_INLINE_VISIBILITY |
| 6902 | bool compare_exchange_weak(long long& __v, long long __e, |
| 6903 | memory_order __s = memory_order_seq_cst) volatile |
| 6904 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 6905 | __translate_memory_order(__s));} |
| 6906 | _LIBCPP_INLINE_VISIBILITY |
| 6907 | bool compare_exchange_weak(long long& __v, long long __e, |
| 6908 | memory_order __s = memory_order_seq_cst) |
| 6909 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 6910 | __translate_memory_order(__s));} |
| 6911 | _LIBCPP_INLINE_VISIBILITY |
| 6912 | bool compare_exchange_strong(long long& __v, long long __e, |
| 6913 | memory_order __s = memory_order_seq_cst) volatile |
| 6914 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 6915 | __translate_memory_order(__s));} |
| 6916 | _LIBCPP_INLINE_VISIBILITY |
| 6917 | bool compare_exchange_strong(long long& __v, long long __e, |
| 6918 | memory_order __s = memory_order_seq_cst) |
| 6919 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 6920 | __translate_memory_order(__s));} |
| 6921 | _LIBCPP_INLINE_VISIBILITY |
| 6922 | long long fetch_add(long long __v, |
| 6923 | memory_order __o = memory_order_seq_cst) volatile |
| 6924 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 6925 | _LIBCPP_INLINE_VISIBILITY |
| 6926 | long long fetch_add(long long __v, |
| 6927 | memory_order __o = memory_order_seq_cst) |
| 6928 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 6929 | _LIBCPP_INLINE_VISIBILITY |
| 6930 | long long fetch_sub(long long __v, |
| 6931 | memory_order __o = memory_order_seq_cst) volatile |
| 6932 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 6933 | _LIBCPP_INLINE_VISIBILITY |
| 6934 | long long fetch_sub(long long __v, |
| 6935 | memory_order __o = memory_order_seq_cst) |
| 6936 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 6937 | _LIBCPP_INLINE_VISIBILITY |
| 6938 | long long fetch_and(long long __v, |
| 6939 | memory_order __o = memory_order_seq_cst) volatile |
| 6940 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 6941 | _LIBCPP_INLINE_VISIBILITY |
| 6942 | long long fetch_and(long long __v, |
| 6943 | memory_order __o = memory_order_seq_cst) |
| 6944 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 6945 | _LIBCPP_INLINE_VISIBILITY |
| 6946 | long long fetch_or(long long __v, |
| 6947 | memory_order __o = memory_order_seq_cst) volatile |
| 6948 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 6949 | _LIBCPP_INLINE_VISIBILITY |
| 6950 | long long fetch_or(long long __v, |
| 6951 | memory_order __o = memory_order_seq_cst) |
| 6952 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 6953 | _LIBCPP_INLINE_VISIBILITY |
| 6954 | long long fetch_xor(long long __v, |
| 6955 | memory_order __o = memory_order_seq_cst) volatile |
| 6956 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 6957 | _LIBCPP_INLINE_VISIBILITY |
| 6958 | long long fetch_xor(long long __v, |
| 6959 | memory_order __o = memory_order_seq_cst) |
| 6960 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 6961 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 6962 | atomic_llong() = default; |
| 6963 | #else |
| 6964 | _LIBCPP_INLINE_VISIBILITY |
| 6965 | atomic_llong() {} |
| 6966 | #endif |
| 6967 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 6968 | constexpr atomic_llong(long long __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 6969 | : __v_(__v) {} |
| 6970 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 6971 | atomic_llong(const atomic_llong&) = delete; |
| 6972 | atomic_llong& operator=(const atomic_llong&) = delete; |
| 6973 | atomic_llong& operator=(const atomic_llong&) volatile = delete; |
| 6974 | #else |
| 6975 | private: |
| 6976 | atomic_llong(const atomic_llong&); |
| 6977 | atomic_llong& operator=(const atomic_llong&); |
| 6978 | atomic_llong& operator=(const atomic_llong&) volatile; |
| 6979 | public: |
| 6980 | #endif |
| 6981 | _LIBCPP_INLINE_VISIBILITY |
| 6982 | long long operator=(long long __v) volatile |
| 6983 | {store(__v); return __v;} |
| 6984 | _LIBCPP_INLINE_VISIBILITY |
| 6985 | long long operator=(long long __v) |
| 6986 | {store(__v); return __v;} |
| 6987 | _LIBCPP_INLINE_VISIBILITY |
| 6988 | long long operator++(int) volatile |
| 6989 | {typedef long long type; return fetch_add(type(1));} |
| 6990 | _LIBCPP_INLINE_VISIBILITY |
| 6991 | long operator++(int) |
| 6992 | {typedef long long type; return fetch_add(type(1));} |
| 6993 | _LIBCPP_INLINE_VISIBILITY |
| 6994 | long operator--(int) volatile |
| 6995 | {typedef long long type; return fetch_sub(type(1));} |
| 6996 | _LIBCPP_INLINE_VISIBILITY |
| 6997 | long operator--(int) |
| 6998 | {typedef long long type; return fetch_sub(type(1));} |
| 6999 | _LIBCPP_INLINE_VISIBILITY |
| 7000 | long operator++() volatile |
| 7001 | {typedef long long type; return type(fetch_add(type(1)) + 1);} |
| 7002 | _LIBCPP_INLINE_VISIBILITY |
| 7003 | long operator++() |
| 7004 | {typedef long long type; return type(fetch_add(type(1)) + 1);} |
| 7005 | _LIBCPP_INLINE_VISIBILITY |
| 7006 | long operator--() volatile |
| 7007 | {typedef long long type; return type(fetch_sub(type(1)) - 1);} |
| 7008 | _LIBCPP_INLINE_VISIBILITY |
| 7009 | long operator--() |
| 7010 | {typedef long long type; return type(fetch_sub(type(1)) - 1);} |
| 7011 | _LIBCPP_INLINE_VISIBILITY |
| 7012 | long operator+=(long __v) volatile |
| 7013 | {typedef long long type; return type(fetch_add(__v) + __v);} |
| 7014 | _LIBCPP_INLINE_VISIBILITY |
| 7015 | long operator+=(long __v) |
| 7016 | {typedef long long type; return type(fetch_add(__v) + __v);} |
| 7017 | _LIBCPP_INLINE_VISIBILITY |
| 7018 | long operator-=(long __v) volatile |
| 7019 | {typedef long long type; return type(fetch_sub(__v) - __v);} |
| 7020 | _LIBCPP_INLINE_VISIBILITY |
| 7021 | long operator-=(long __v) |
| 7022 | {typedef long long type; return type(fetch_sub(__v) - __v);} |
| 7023 | _LIBCPP_INLINE_VISIBILITY |
| 7024 | long operator&=(long __v) volatile |
| 7025 | {typedef long long type; return type(fetch_and(__v) & __v);} |
| 7026 | _LIBCPP_INLINE_VISIBILITY |
| 7027 | long operator&=(long __v) |
| 7028 | {typedef long long type; return type(fetch_and(__v) & __v);} |
| 7029 | _LIBCPP_INLINE_VISIBILITY |
| 7030 | long operator|=(long __v) volatile |
| 7031 | {typedef long long type; return type(fetch_or(__v) | __v);} |
| 7032 | _LIBCPP_INLINE_VISIBILITY |
| 7033 | long operator|=(long __v) |
| 7034 | {typedef long long type; return type(fetch_or(__v) | __v);} |
| 7035 | _LIBCPP_INLINE_VISIBILITY |
| 7036 | long operator^=(long __v) volatile |
| 7037 | {typedef long long type; return type(fetch_xor(__v) ^ __v);} |
| 7038 | _LIBCPP_INLINE_VISIBILITY |
| 7039 | long operator^=(long __v) |
| 7040 | {typedef long long type; return type(fetch_xor(__v) ^ __v);} |
| 7041 | } atomic_llong; |
| 7042 | |
| 7043 | inline _LIBCPP_INLINE_VISIBILITY |
| 7044 | bool |
| 7045 | atomic_is_lock_free(const volatile atomic_llong*) |
| 7046 | { |
| 7047 | typedef long long type; |
| 7048 | return __atomic_is_lock_free(type); |
| 7049 | } |
| 7050 | |
| 7051 | inline _LIBCPP_INLINE_VISIBILITY |
| 7052 | bool |
| 7053 | atomic_is_lock_free(const atomic_llong* __obj) |
| 7054 | { |
| 7055 | return atomic_is_lock_free(const_cast<volatile atomic_llong*>(__obj)); |
| 7056 | } |
| 7057 | |
| 7058 | inline _LIBCPP_INLINE_VISIBILITY |
| 7059 | void |
| 7060 | atomic_init(volatile atomic_llong* __obj, long long __desr) |
| 7061 | { |
| 7062 | __obj->__v_ = __desr; |
| 7063 | } |
| 7064 | |
| 7065 | inline _LIBCPP_INLINE_VISIBILITY |
| 7066 | void |
| 7067 | atomic_init(atomic_llong* __obj, long long __desr) |
| 7068 | { |
| 7069 | __obj->__v_ = __desr; |
| 7070 | } |
| 7071 | |
| 7072 | inline _LIBCPP_INLINE_VISIBILITY |
| 7073 | void |
| 7074 | atomic_store(volatile atomic_llong* __obj, long long __desr) |
| 7075 | { |
| 7076 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 7077 | } |
| 7078 | |
| 7079 | inline _LIBCPP_INLINE_VISIBILITY |
| 7080 | void |
| 7081 | atomic_store(atomic_llong* __obj, long long __desr) |
| 7082 | { |
| 7083 | atomic_store(const_cast<volatile atomic_llong*>(__obj), __desr); |
| 7084 | } |
| 7085 | |
| 7086 | inline _LIBCPP_INLINE_VISIBILITY |
| 7087 | void |
| 7088 | atomic_store_explicit(volatile atomic_llong* __obj, long long __desr, |
| 7089 | memory_order __o) |
| 7090 | { |
| 7091 | __atomic_store(&__obj->__v_, __desr, __o); |
| 7092 | } |
| 7093 | |
| 7094 | inline _LIBCPP_INLINE_VISIBILITY |
| 7095 | void |
| 7096 | atomic_store_explicit(atomic_llong* __obj, long long __desr, |
| 7097 | memory_order __o) |
| 7098 | { |
| 7099 | atomic_store_explicit(const_cast<volatile atomic_llong*>(__obj), __desr, |
| 7100 | __o); |
| 7101 | } |
| 7102 | |
| 7103 | inline _LIBCPP_INLINE_VISIBILITY |
| 7104 | long long |
| 7105 | atomic_load(const volatile atomic_llong* __obj) |
| 7106 | { |
| 7107 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 7108 | } |
| 7109 | |
| 7110 | inline _LIBCPP_INLINE_VISIBILITY |
| 7111 | long long |
| 7112 | atomic_load(const atomic_llong* __obj) |
| 7113 | { |
| 7114 | return atomic_load(const_cast<const volatile atomic_llong*>(__obj)); |
| 7115 | } |
| 7116 | |
| 7117 | inline _LIBCPP_INLINE_VISIBILITY |
| 7118 | long long |
| 7119 | atomic_load_explicit(const volatile atomic_llong* __obj, memory_order __o) |
| 7120 | { |
| 7121 | return __atomic_load(&__obj->__v_, __o); |
| 7122 | } |
| 7123 | |
| 7124 | inline _LIBCPP_INLINE_VISIBILITY |
| 7125 | long long |
| 7126 | atomic_load_explicit(const atomic_llong* __obj, memory_order __o) |
| 7127 | { |
| 7128 | return atomic_load_explicit(const_cast<const volatile atomic_llong*> |
| 7129 | (__obj), __o); |
| 7130 | } |
| 7131 | |
| 7132 | inline _LIBCPP_INLINE_VISIBILITY |
| 7133 | long long |
| 7134 | atomic_exchange(volatile atomic_llong* __obj, long long __desr) |
| 7135 | { |
| 7136 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 7137 | } |
| 7138 | |
| 7139 | inline _LIBCPP_INLINE_VISIBILITY |
| 7140 | long long |
| 7141 | atomic_exchange(atomic_llong* __obj, long long __desr) |
| 7142 | { |
| 7143 | return atomic_exchange(const_cast<volatile atomic_llong*>(__obj), __desr); |
| 7144 | } |
| 7145 | |
| 7146 | inline _LIBCPP_INLINE_VISIBILITY |
| 7147 | long long |
| 7148 | atomic_exchange_explicit(volatile atomic_llong* __obj, long long __desr, |
| 7149 | memory_order __o) |
| 7150 | { |
| 7151 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 7152 | } |
| 7153 | |
| 7154 | inline _LIBCPP_INLINE_VISIBILITY |
| 7155 | long long |
| 7156 | atomic_exchange_explicit(atomic_llong* __obj, long long __desr, |
| 7157 | memory_order __o) |
| 7158 | { |
| 7159 | return atomic_exchange_explicit(const_cast<volatile atomic_llong*> |
| 7160 | (__obj), __desr, __o); |
| 7161 | } |
| 7162 | |
| 7163 | inline _LIBCPP_INLINE_VISIBILITY |
| 7164 | bool |
| 7165 | atomic_compare_exchange_weak(volatile atomic_llong* __obj, long long* __exp, |
| 7166 | long long __desr) |
| 7167 | { |
| 7168 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 7169 | memory_order_seq_cst, memory_order_seq_cst); |
| 7170 | } |
| 7171 | |
| 7172 | inline _LIBCPP_INLINE_VISIBILITY |
| 7173 | bool |
| 7174 | atomic_compare_exchange_weak(atomic_llong* __obj, long long* __exp, |
| 7175 | long long __desr) |
| 7176 | { |
| 7177 | return atomic_compare_exchange_weak(const_cast<volatile atomic_llong*> |
| 7178 | (__obj), __exp, __desr); |
| 7179 | } |
| 7180 | |
| 7181 | inline _LIBCPP_INLINE_VISIBILITY |
| 7182 | bool |
| 7183 | atomic_compare_exchange_strong(volatile atomic_llong* __obj, |
| 7184 | long long* __exp, long long __desr) |
| 7185 | { |
| 7186 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 7187 | memory_order_seq_cst, memory_order_seq_cst); |
| 7188 | } |
| 7189 | |
| 7190 | inline _LIBCPP_INLINE_VISIBILITY |
| 7191 | bool |
| 7192 | atomic_compare_exchange_strong(atomic_llong* __obj, long long* __exp, |
| 7193 | long long __desr) |
| 7194 | { |
| 7195 | return atomic_compare_exchange_strong(const_cast<volatile atomic_llong*> |
| 7196 | (__obj), __exp, __desr); |
| 7197 | } |
| 7198 | |
| 7199 | inline _LIBCPP_INLINE_VISIBILITY |
| 7200 | bool |
| 7201 | atomic_compare_exchange_weak_explicit(volatile atomic_llong* __obj, |
| 7202 | long long* __exp, |
| 7203 | long long __desr, memory_order __s, |
| 7204 | memory_order __f) |
| 7205 | { |
| 7206 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 7207 | __f); |
| 7208 | } |
| 7209 | |
| 7210 | inline _LIBCPP_INLINE_VISIBILITY |
| 7211 | bool |
| 7212 | atomic_compare_exchange_weak_explicit(atomic_llong* __obj, long long* __exp, |
| 7213 | long long __desr, memory_order __s, |
| 7214 | memory_order __f) |
| 7215 | { |
| 7216 | return atomic_compare_exchange_weak_explicit( |
| 7217 | const_cast<volatile atomic_llong*>(__obj), __exp, __desr, __s, __f); |
| 7218 | } |
| 7219 | |
| 7220 | inline _LIBCPP_INLINE_VISIBILITY |
| 7221 | bool |
| 7222 | atomic_compare_exchange_strong_explicit(volatile atomic_llong* __obj, |
| 7223 | long long* __exp, |
| 7224 | long long __desr, memory_order __s, |
| 7225 | memory_order __f) |
| 7226 | { |
| 7227 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 7228 | __f); |
| 7229 | } |
| 7230 | |
| 7231 | inline _LIBCPP_INLINE_VISIBILITY |
| 7232 | bool |
| 7233 | atomic_compare_exchange_strong_explicit(atomic_llong* __obj, |
| 7234 | long long* __exp, |
| 7235 | long long __desr, memory_order __s, |
| 7236 | memory_order __f) |
| 7237 | { |
| 7238 | return atomic_compare_exchange_strong_explicit( |
| 7239 | const_cast<volatile atomic_llong*>(__obj), __exp, __desr, __s, __f); |
| 7240 | } |
| 7241 | |
| 7242 | inline _LIBCPP_INLINE_VISIBILITY |
| 7243 | long long |
| 7244 | atomic_fetch_add(volatile atomic_llong* __obj, long long __v) |
| 7245 | { |
| 7246 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 7247 | } |
| 7248 | |
| 7249 | inline _LIBCPP_INLINE_VISIBILITY |
| 7250 | long long |
| 7251 | atomic_fetch_add(atomic_llong* __obj, long long __v) |
| 7252 | { |
| 7253 | return atomic_fetch_add(const_cast<volatile atomic_llong*>(__obj), __v); |
| 7254 | } |
| 7255 | |
| 7256 | inline _LIBCPP_INLINE_VISIBILITY |
| 7257 | long long |
| 7258 | atomic_fetch_add_explicit(volatile atomic_llong* __obj, long long __v, |
| 7259 | memory_order __o) |
| 7260 | { |
| 7261 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 7262 | } |
| 7263 | |
| 7264 | inline _LIBCPP_INLINE_VISIBILITY |
| 7265 | long long |
| 7266 | atomic_fetch_add_explicit(atomic_llong* __obj, long long __v, |
| 7267 | memory_order __o) |
| 7268 | { |
| 7269 | return atomic_fetch_add_explicit(const_cast<volatile atomic_llong*>(__obj), |
| 7270 | __v, __o); |
| 7271 | } |
| 7272 | |
| 7273 | inline _LIBCPP_INLINE_VISIBILITY |
| 7274 | long long |
| 7275 | atomic_fetch_sub(volatile atomic_llong* __obj, long long __v) |
| 7276 | { |
| 7277 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 7278 | } |
| 7279 | |
| 7280 | inline _LIBCPP_INLINE_VISIBILITY |
| 7281 | long long |
| 7282 | atomic_fetch_sub(atomic_llong* __obj, long long __v) |
| 7283 | { |
| 7284 | return atomic_fetch_sub(const_cast<volatile atomic_llong*>(__obj), __v); |
| 7285 | } |
| 7286 | |
| 7287 | inline _LIBCPP_INLINE_VISIBILITY |
| 7288 | long long |
| 7289 | atomic_fetch_sub_explicit(volatile atomic_llong* __obj, long long __v, |
| 7290 | memory_order __o) |
| 7291 | { |
| 7292 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 7293 | } |
| 7294 | |
| 7295 | inline _LIBCPP_INLINE_VISIBILITY |
| 7296 | long long |
| 7297 | atomic_fetch_sub_explicit(atomic_llong* __obj, long long __v, |
| 7298 | memory_order __o) |
| 7299 | { |
| 7300 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_llong*>(__obj), |
| 7301 | __v, __o); |
| 7302 | } |
| 7303 | |
| 7304 | inline _LIBCPP_INLINE_VISIBILITY |
| 7305 | long long |
| 7306 | atomic_fetch_and(volatile atomic_llong* __obj, long long __v) |
| 7307 | { |
| 7308 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 7309 | } |
| 7310 | |
| 7311 | inline _LIBCPP_INLINE_VISIBILITY |
| 7312 | long long |
| 7313 | atomic_fetch_and(atomic_llong* __obj, long long __v) |
| 7314 | { |
| 7315 | return atomic_fetch_and(const_cast<volatile atomic_llong*>(__obj), __v); |
| 7316 | } |
| 7317 | |
| 7318 | inline _LIBCPP_INLINE_VISIBILITY |
| 7319 | long long |
| 7320 | atomic_fetch_and_explicit(volatile atomic_llong* __obj, long long __v, |
| 7321 | memory_order __o) |
| 7322 | { |
| 7323 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 7324 | } |
| 7325 | |
| 7326 | inline _LIBCPP_INLINE_VISIBILITY |
| 7327 | long long |
| 7328 | atomic_fetch_and_explicit(atomic_llong* __obj, long long __v, |
| 7329 | memory_order __o) |
| 7330 | { |
| 7331 | return atomic_fetch_and_explicit(const_cast<volatile atomic_llong*>(__obj), |
| 7332 | __v, __o); |
| 7333 | } |
| 7334 | |
| 7335 | inline _LIBCPP_INLINE_VISIBILITY |
| 7336 | long long |
| 7337 | atomic_fetch_or(volatile atomic_llong* __obj, long long __v) |
| 7338 | { |
| 7339 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 7340 | } |
| 7341 | |
| 7342 | inline _LIBCPP_INLINE_VISIBILITY |
| 7343 | long long |
| 7344 | atomic_fetch_or(atomic_llong* __obj, long long __v) |
| 7345 | { |
| 7346 | return atomic_fetch_or(const_cast<volatile atomic_llong*>(__obj), __v); |
| 7347 | } |
| 7348 | |
| 7349 | inline _LIBCPP_INLINE_VISIBILITY |
| 7350 | long long |
| 7351 | atomic_fetch_or_explicit(volatile atomic_llong* __obj, long long __v, |
| 7352 | memory_order __o) |
| 7353 | { |
| 7354 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 7355 | } |
| 7356 | |
| 7357 | inline _LIBCPP_INLINE_VISIBILITY |
| 7358 | long long |
| 7359 | atomic_fetch_or_explicit(atomic_llong* __obj, long long __v, |
| 7360 | memory_order __o) |
| 7361 | { |
| 7362 | return atomic_fetch_or_explicit(const_cast<volatile atomic_llong*>(__obj), |
| 7363 | __v, __o); |
| 7364 | } |
| 7365 | |
| 7366 | inline _LIBCPP_INLINE_VISIBILITY |
| 7367 | long long |
| 7368 | atomic_fetch_xor(volatile atomic_llong* __obj, long long __v) |
| 7369 | { |
| 7370 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 7371 | } |
| 7372 | |
| 7373 | inline _LIBCPP_INLINE_VISIBILITY |
| 7374 | long long |
| 7375 | atomic_fetch_xor(atomic_llong* __obj, long long __v) |
| 7376 | { |
| 7377 | return atomic_fetch_xor(const_cast<volatile atomic_llong*>(__obj), __v); |
| 7378 | } |
| 7379 | |
| 7380 | inline _LIBCPP_INLINE_VISIBILITY |
| 7381 | long long |
| 7382 | atomic_fetch_xor_explicit(volatile atomic_llong* __obj, long long __v, |
| 7383 | memory_order __o) |
| 7384 | { |
| 7385 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 7386 | } |
| 7387 | |
| 7388 | inline _LIBCPP_INLINE_VISIBILITY |
| 7389 | long long |
| 7390 | atomic_fetch_xor_explicit(atomic_llong* __obj, long long __v, |
| 7391 | memory_order __o) |
| 7392 | { |
| 7393 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_llong*>(__obj), |
| 7394 | __v, __o); |
| 7395 | } |
| 7396 | |
| 7397 | // atomic_ullong |
| 7398 | |
| 7399 | struct atomic_ullong; |
| 7400 | |
| 7401 | bool atomic_is_lock_free(const volatile atomic_ullong*); |
| 7402 | bool atomic_is_lock_free(const atomic_ullong*); |
| 7403 | void atomic_init(volatile atomic_ullong*, unsigned long long); |
| 7404 | void atomic_init(atomic_ullong*, unsigned long long); |
| 7405 | void atomic_store(volatile atomic_ullong*, unsigned long long); |
| 7406 | void atomic_store(atomic_ullong*, unsigned long long); |
| 7407 | void atomic_store_explicit(volatile atomic_ullong*, unsigned long long, |
| 7408 | memory_order); |
| 7409 | void atomic_store_explicit(atomic_ullong*, unsigned long long, memory_order); |
| 7410 | unsigned long long atomic_load(const volatile atomic_ullong*); |
| 7411 | unsigned long long atomic_load(const atomic_ullong*); |
| 7412 | unsigned long long atomic_load_explicit(const volatile atomic_ullong*, |
| 7413 | memory_order); |
| 7414 | unsigned long long atomic_load_explicit(const atomic_ullong*, memory_order); |
| 7415 | unsigned long long atomic_exchange(volatile atomic_ullong*, unsigned long long); |
| 7416 | unsigned long long atomic_exchange(atomic_ullong*, unsigned long long); |
| 7417 | unsigned long long atomic_exchange_explicit(volatile atomic_ullong*, |
| 7418 | unsigned long long, memory_order); |
| 7419 | unsigned long long atomic_exchange_explicit(atomic_ullong*, unsigned long long, |
| 7420 | memory_order); |
| 7421 | bool atomic_compare_exchange_weak(volatile atomic_ullong*, unsigned long long*, |
| 7422 | unsigned long long); |
| 7423 | bool atomic_compare_exchange_weak(atomic_ullong*, unsigned long long*, |
| 7424 | unsigned long long); |
| 7425 | bool atomic_compare_exchange_strong(volatile atomic_ullong*, |
| 7426 | unsigned long long*, unsigned long long); |
| 7427 | bool atomic_compare_exchange_strong(atomic_ullong*, unsigned long long*, |
| 7428 | unsigned long long); |
| 7429 | bool atomic_compare_exchange_weak_explicit(volatile atomic_ullong*, |
| 7430 | unsigned long long*, |
| 7431 | unsigned long long, |
| 7432 | memory_order, memory_order); |
| 7433 | bool atomic_compare_exchange_weak_explicit(atomic_ullong*, unsigned long long*, |
| 7434 | unsigned long long, memory_order, |
| 7435 | memory_order); |
| 7436 | bool atomic_compare_exchange_strong_explicit(volatile atomic_ullong*, |
| 7437 | unsigned long long*, |
| 7438 | unsigned long long, |
| 7439 | memory_order, memory_order); |
| 7440 | bool atomic_compare_exchange_strong_explicit(atomic_ullong*, |
| 7441 | unsigned long long*, |
| 7442 | unsigned long long, memory_order, |
| 7443 | memory_order); |
| 7444 | unsigned long long atomic_fetch_add(volatile atomic_ullong*, |
| 7445 | unsigned long long); |
| 7446 | unsigned long long atomic_fetch_add(atomic_ullong*, unsigned long long); |
| 7447 | unsigned long long atomic_fetch_add_explicit(volatile atomic_ullong*, |
| 7448 | unsigned long long, memory_order); |
| 7449 | unsigned long long atomic_fetch_add_explicit(atomic_ullong*, unsigned long long, |
| 7450 | memory_order); |
| 7451 | unsigned long long atomic_fetch_sub(volatile atomic_ullong*, |
| 7452 | unsigned long long); |
| 7453 | unsigned long long atomic_fetch_sub(atomic_ullong*, unsigned long long); |
| 7454 | unsigned long long atomic_fetch_sub_explicit(volatile atomic_ullong*, |
| 7455 | unsigned long long, memory_order); |
| 7456 | unsigned long long atomic_fetch_sub_explicit(atomic_ullong*, unsigned long long, |
| 7457 | memory_order); |
| 7458 | unsigned long long atomic_fetch_and(volatile atomic_ullong*, unsigned long long); |
| 7459 | unsigned long long atomic_fetch_and(atomic_ullong*, unsigned long long); |
| 7460 | unsigned long long atomic_fetch_and_explicit(volatile atomic_ullong*, |
| 7461 | unsigned long long, memory_order); |
| 7462 | unsigned long long atomic_fetch_and_explicit(atomic_ullong*, unsigned long long, |
| 7463 | memory_order); |
| 7464 | unsigned long long atomic_fetch_or(volatile atomic_ullong*, unsigned long long); |
| 7465 | unsigned long long atomic_fetch_or(atomic_ullong*, unsigned long long); |
| 7466 | unsigned long long atomic_fetch_or_explicit(volatile atomic_ullong*, |
| 7467 | unsigned long long, memory_order); |
| 7468 | unsigned long long atomic_fetch_or_explicit(atomic_ullong*, unsigned long long, |
| 7469 | memory_order); |
| 7470 | unsigned long long atomic_fetch_xor(volatile atomic_ullong*, |
| 7471 | unsigned long long); |
| 7472 | unsigned long long atomic_fetch_xor(atomic_ullong*, unsigned long long); |
| 7473 | unsigned long long atomic_fetch_xor_explicit(volatile atomic_ullong*, |
| 7474 | unsigned long long, memory_order); |
| 7475 | unsigned long long atomic_fetch_xor_explicit(atomic_ullong*, unsigned long long, |
| 7476 | memory_order); |
| 7477 | |
| 7478 | typedef struct atomic_ullong |
| 7479 | { |
| 7480 | unsigned long long __v_; |
| 7481 | |
| 7482 | _LIBCPP_INLINE_VISIBILITY |
| 7483 | bool is_lock_free() const volatile |
| 7484 | {return atomic_is_lock_free(this);} |
| 7485 | _LIBCPP_INLINE_VISIBILITY |
| 7486 | bool is_lock_free() const |
| 7487 | {return atomic_is_lock_free(this);} |
| 7488 | _LIBCPP_INLINE_VISIBILITY |
| 7489 | void store(unsigned long long __v, |
| 7490 | memory_order __o = memory_order_seq_cst) volatile |
| 7491 | {atomic_store_explicit(this, __v, __o);} |
| 7492 | _LIBCPP_INLINE_VISIBILITY |
| 7493 | void store(unsigned long long __v, memory_order __o = memory_order_seq_cst) |
| 7494 | {atomic_store_explicit(this, __v, __o);} |
| 7495 | _LIBCPP_INLINE_VISIBILITY |
| 7496 | unsigned long long load(memory_order __o = memory_order_seq_cst) const |
| 7497 | volatile |
| 7498 | {return atomic_load_explicit(this, __o);} |
| 7499 | _LIBCPP_INLINE_VISIBILITY |
| 7500 | unsigned long long load(memory_order __o = memory_order_seq_cst) const |
| 7501 | {return atomic_load_explicit(this, __o);} |
| 7502 | _LIBCPP_INLINE_VISIBILITY |
| 7503 | operator unsigned long long() const volatile |
| 7504 | {return load();} |
| 7505 | _LIBCPP_INLINE_VISIBILITY |
| 7506 | operator unsigned long long() const |
| 7507 | {return load();} |
| 7508 | _LIBCPP_INLINE_VISIBILITY |
| 7509 | unsigned long long exchange(unsigned long long __v, |
| 7510 | memory_order __o = memory_order_seq_cst) volatile |
| 7511 | {return atomic_exchange_explicit(this, __v, __o);} |
| 7512 | _LIBCPP_INLINE_VISIBILITY |
| 7513 | unsigned long long exchange(unsigned long long __v, |
| 7514 | memory_order __o = memory_order_seq_cst) |
| 7515 | {return atomic_exchange_explicit(this, __v, __o);} |
| 7516 | _LIBCPP_INLINE_VISIBILITY |
| 7517 | bool compare_exchange_weak(unsigned long long& __v, unsigned long long __e, |
| 7518 | memory_order __s, memory_order __f) volatile |
| 7519 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 7520 | __f);} |
| 7521 | _LIBCPP_INLINE_VISIBILITY |
| 7522 | bool compare_exchange_weak(unsigned long long& __v, unsigned long long __e, |
| 7523 | memory_order __s, memory_order __f) |
| 7524 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 7525 | __f);} |
| 7526 | _LIBCPP_INLINE_VISIBILITY |
| 7527 | bool compare_exchange_strong(unsigned long long& __v, unsigned long long __e, |
| 7528 | memory_order __s, memory_order __f) volatile |
| 7529 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 7530 | __f);} |
| 7531 | _LIBCPP_INLINE_VISIBILITY |
| 7532 | bool compare_exchange_strong(unsigned long long& __v, unsigned long long __e, |
| 7533 | memory_order __s, memory_order __f) |
| 7534 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 7535 | __f);} |
| 7536 | _LIBCPP_INLINE_VISIBILITY |
| 7537 | bool compare_exchange_weak(unsigned long long& __v, unsigned long long __e, |
| 7538 | memory_order __s = memory_order_seq_cst) volatile |
| 7539 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 7540 | __translate_memory_order(__s));} |
| 7541 | _LIBCPP_INLINE_VISIBILITY |
| 7542 | bool compare_exchange_weak(unsigned long long& __v, unsigned long long __e, |
| 7543 | memory_order __s = memory_order_seq_cst) |
| 7544 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 7545 | __translate_memory_order(__s));} |
| 7546 | _LIBCPP_INLINE_VISIBILITY |
| 7547 | bool compare_exchange_strong(unsigned long long& __v, unsigned long long __e, |
| 7548 | memory_order __s = memory_order_seq_cst) volatile |
| 7549 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 7550 | __translate_memory_order(__s));} |
| 7551 | _LIBCPP_INLINE_VISIBILITY |
| 7552 | bool compare_exchange_strong(unsigned long long& __v, unsigned long long __e, |
| 7553 | memory_order __s = memory_order_seq_cst) |
| 7554 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 7555 | __translate_memory_order(__s));} |
| 7556 | _LIBCPP_INLINE_VISIBILITY |
| 7557 | unsigned long long fetch_add(unsigned long long __v, |
| 7558 | memory_order __o = memory_order_seq_cst) volatile |
| 7559 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 7560 | _LIBCPP_INLINE_VISIBILITY |
| 7561 | unsigned long long fetch_add(unsigned long long __v, |
| 7562 | memory_order __o = memory_order_seq_cst) |
| 7563 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 7564 | _LIBCPP_INLINE_VISIBILITY |
| 7565 | unsigned long long fetch_sub(unsigned long long __v, |
| 7566 | memory_order __o = memory_order_seq_cst) volatile |
| 7567 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 7568 | _LIBCPP_INLINE_VISIBILITY |
| 7569 | unsigned long long fetch_sub(unsigned long long __v, |
| 7570 | memory_order __o = memory_order_seq_cst) |
| 7571 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 7572 | _LIBCPP_INLINE_VISIBILITY |
| 7573 | unsigned long long fetch_and(unsigned long long __v, |
| 7574 | memory_order __o = memory_order_seq_cst) volatile |
| 7575 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 7576 | _LIBCPP_INLINE_VISIBILITY |
| 7577 | unsigned long long fetch_and(unsigned long long __v, |
| 7578 | memory_order __o = memory_order_seq_cst) |
| 7579 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 7580 | _LIBCPP_INLINE_VISIBILITY |
| 7581 | unsigned long long fetch_or(unsigned long long __v, |
| 7582 | memory_order __o = memory_order_seq_cst) volatile |
| 7583 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 7584 | _LIBCPP_INLINE_VISIBILITY |
| 7585 | unsigned long long fetch_or(unsigned long long __v, |
| 7586 | memory_order __o = memory_order_seq_cst) |
| 7587 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 7588 | _LIBCPP_INLINE_VISIBILITY |
| 7589 | unsigned long long fetch_xor(unsigned long long __v, |
| 7590 | memory_order __o = memory_order_seq_cst) volatile |
| 7591 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 7592 | _LIBCPP_INLINE_VISIBILITY |
| 7593 | unsigned long long fetch_xor(unsigned long long __v, |
| 7594 | memory_order __o = memory_order_seq_cst) |
| 7595 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 7596 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 7597 | atomic_ullong() = default; |
| 7598 | #else |
| 7599 | _LIBCPP_INLINE_VISIBILITY |
| 7600 | atomic_ullong() {} |
| 7601 | #endif |
| 7602 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 7603 | constexpr atomic_ullong(unsigned long long __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 7604 | : __v_(__v) {} |
| 7605 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 7606 | atomic_ullong(const atomic_ullong&) = delete; |
| 7607 | atomic_ullong& operator=(const atomic_ullong&) = delete; |
| 7608 | atomic_ullong& operator=(const atomic_ullong&) volatile = delete; |
| 7609 | #else |
| 7610 | private: |
| 7611 | atomic_ullong(const atomic_ullong&); |
| 7612 | atomic_ullong& operator=(const atomic_ullong&); |
| 7613 | atomic_ullong& operator=(const atomic_ullong&) volatile; |
| 7614 | public: |
| 7615 | #endif |
| 7616 | _LIBCPP_INLINE_VISIBILITY |
| 7617 | unsigned long long operator=(unsigned long long __v) volatile |
| 7618 | {store(__v); return __v;} |
| 7619 | _LIBCPP_INLINE_VISIBILITY |
| 7620 | unsigned long long operator=(unsigned long long __v) |
| 7621 | {store(__v); return __v;} |
| 7622 | _LIBCPP_INLINE_VISIBILITY |
| 7623 | unsigned long long operator++(int) volatile |
| 7624 | {typedef unsigned long long type; return fetch_add(type(1));} |
| 7625 | _LIBCPP_INLINE_VISIBILITY |
| 7626 | long operator++(int) |
| 7627 | {typedef unsigned long long type; return fetch_add(type(1));} |
| 7628 | _LIBCPP_INLINE_VISIBILITY |
| 7629 | long operator--(int) volatile |
| 7630 | {typedef unsigned long long type; return fetch_sub(type(1));} |
| 7631 | _LIBCPP_INLINE_VISIBILITY |
| 7632 | long operator--(int) |
| 7633 | {typedef unsigned long long type; return fetch_sub(type(1));} |
| 7634 | _LIBCPP_INLINE_VISIBILITY |
| 7635 | long operator++() volatile |
| 7636 | {typedef unsigned long long type; return type(fetch_add(type(1)) + 1);} |
| 7637 | _LIBCPP_INLINE_VISIBILITY |
| 7638 | long operator++() |
| 7639 | {typedef unsigned long long type; return type(fetch_add(type(1)) + 1);} |
| 7640 | _LIBCPP_INLINE_VISIBILITY |
| 7641 | long operator--() volatile |
| 7642 | {typedef unsigned long long type; return type(fetch_sub(type(1)) - 1);} |
| 7643 | _LIBCPP_INLINE_VISIBILITY |
| 7644 | long operator--() |
| 7645 | {typedef unsigned long long type; return type(fetch_sub(type(1)) - 1);} |
| 7646 | _LIBCPP_INLINE_VISIBILITY |
| 7647 | long operator+=(long __v) volatile |
| 7648 | {typedef unsigned long long type; return type(fetch_add(__v) + __v);} |
| 7649 | _LIBCPP_INLINE_VISIBILITY |
| 7650 | long operator+=(long __v) |
| 7651 | {typedef unsigned long long type; return type(fetch_add(__v) + __v);} |
| 7652 | _LIBCPP_INLINE_VISIBILITY |
| 7653 | long operator-=(long __v) volatile |
| 7654 | {typedef unsigned long long type; return type(fetch_sub(__v) - __v);} |
| 7655 | _LIBCPP_INLINE_VISIBILITY |
| 7656 | long operator-=(long __v) |
| 7657 | {typedef unsigned long long type; return type(fetch_sub(__v) - __v);} |
| 7658 | _LIBCPP_INLINE_VISIBILITY |
| 7659 | long operator&=(long __v) volatile |
| 7660 | {typedef unsigned long long type; return type(fetch_and(__v) & __v);} |
| 7661 | _LIBCPP_INLINE_VISIBILITY |
| 7662 | long operator&=(long __v) |
| 7663 | {typedef unsigned long long type; return type(fetch_and(__v) & __v);} |
| 7664 | _LIBCPP_INLINE_VISIBILITY |
| 7665 | long operator|=(long __v) volatile |
| 7666 | {typedef unsigned long long type; return type(fetch_or(__v) | __v);} |
| 7667 | _LIBCPP_INLINE_VISIBILITY |
| 7668 | long operator|=(long __v) |
| 7669 | {typedef unsigned long long type; return type(fetch_or(__v) | __v);} |
| 7670 | _LIBCPP_INLINE_VISIBILITY |
| 7671 | long operator^=(long __v) volatile |
| 7672 | {typedef unsigned long long type; return type(fetch_xor(__v) ^ __v);} |
| 7673 | _LIBCPP_INLINE_VISIBILITY |
| 7674 | long operator^=(long __v) |
| 7675 | {typedef unsigned long long type; return type(fetch_xor(__v) ^ __v);} |
| 7676 | } atomic_ullong; |
| 7677 | |
| 7678 | inline _LIBCPP_INLINE_VISIBILITY |
| 7679 | bool |
| 7680 | atomic_is_lock_free(const volatile atomic_ullong*) |
| 7681 | { |
| 7682 | typedef unsigned long long type; |
| 7683 | return __atomic_is_lock_free(type); |
| 7684 | } |
| 7685 | |
| 7686 | inline _LIBCPP_INLINE_VISIBILITY |
| 7687 | bool |
| 7688 | atomic_is_lock_free(const atomic_ullong* __obj) |
| 7689 | { |
| 7690 | return atomic_is_lock_free(const_cast<volatile atomic_ullong*>(__obj)); |
| 7691 | } |
| 7692 | |
| 7693 | inline _LIBCPP_INLINE_VISIBILITY |
| 7694 | void |
| 7695 | atomic_init(volatile atomic_ullong* __obj, unsigned long long __desr) |
| 7696 | { |
| 7697 | __obj->__v_ = __desr; |
| 7698 | } |
| 7699 | |
| 7700 | inline _LIBCPP_INLINE_VISIBILITY |
| 7701 | void |
| 7702 | atomic_init(atomic_ullong* __obj, unsigned long long __desr) |
| 7703 | { |
| 7704 | __obj->__v_ = __desr; |
| 7705 | } |
| 7706 | |
| 7707 | inline _LIBCPP_INLINE_VISIBILITY |
| 7708 | void |
| 7709 | atomic_store(volatile atomic_ullong* __obj, unsigned long long __desr) |
| 7710 | { |
| 7711 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 7712 | } |
| 7713 | |
| 7714 | inline _LIBCPP_INLINE_VISIBILITY |
| 7715 | void |
| 7716 | atomic_store(atomic_ullong* __obj, unsigned long long __desr) |
| 7717 | { |
| 7718 | atomic_store(const_cast<volatile atomic_ullong*>(__obj), __desr); |
| 7719 | } |
| 7720 | |
| 7721 | inline _LIBCPP_INLINE_VISIBILITY |
| 7722 | void |
| 7723 | atomic_store_explicit(volatile atomic_ullong* __obj, unsigned long long __desr, |
| 7724 | memory_order __o) |
| 7725 | { |
| 7726 | __atomic_store(&__obj->__v_, __desr, __o); |
| 7727 | } |
| 7728 | |
| 7729 | inline _LIBCPP_INLINE_VISIBILITY |
| 7730 | void |
| 7731 | atomic_store_explicit(atomic_ullong* __obj, unsigned long long __desr, |
| 7732 | memory_order __o) |
| 7733 | { |
| 7734 | atomic_store_explicit(const_cast<volatile atomic_ullong*>(__obj), __desr, |
| 7735 | __o); |
| 7736 | } |
| 7737 | |
| 7738 | inline _LIBCPP_INLINE_VISIBILITY |
| 7739 | unsigned long long |
| 7740 | atomic_load(const volatile atomic_ullong* __obj) |
| 7741 | { |
| 7742 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 7743 | } |
| 7744 | |
| 7745 | inline _LIBCPP_INLINE_VISIBILITY |
| 7746 | unsigned long long |
| 7747 | atomic_load(const atomic_ullong* __obj) |
| 7748 | { |
| 7749 | return atomic_load(const_cast<const volatile atomic_ullong*>(__obj)); |
| 7750 | } |
| 7751 | |
| 7752 | inline _LIBCPP_INLINE_VISIBILITY |
| 7753 | unsigned long long |
| 7754 | atomic_load_explicit(const volatile atomic_ullong* __obj, memory_order __o) |
| 7755 | { |
| 7756 | return __atomic_load(&__obj->__v_, __o); |
| 7757 | } |
| 7758 | |
| 7759 | inline _LIBCPP_INLINE_VISIBILITY |
| 7760 | unsigned long long |
| 7761 | atomic_load_explicit(const atomic_ullong* __obj, memory_order __o) |
| 7762 | { |
| 7763 | return atomic_load_explicit(const_cast<const volatile atomic_ullong*> |
| 7764 | (__obj), __o); |
| 7765 | } |
| 7766 | |
| 7767 | inline _LIBCPP_INLINE_VISIBILITY |
| 7768 | unsigned long long |
| 7769 | atomic_exchange(volatile atomic_ullong* __obj, unsigned long long __desr) |
| 7770 | { |
| 7771 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 7772 | } |
| 7773 | |
| 7774 | inline _LIBCPP_INLINE_VISIBILITY |
| 7775 | unsigned long long |
| 7776 | atomic_exchange(atomic_ullong* __obj, unsigned long long __desr) |
| 7777 | { |
| 7778 | return atomic_exchange(const_cast<volatile atomic_ullong*>(__obj), __desr); |
| 7779 | } |
| 7780 | |
| 7781 | inline _LIBCPP_INLINE_VISIBILITY |
| 7782 | unsigned long long |
| 7783 | atomic_exchange_explicit(volatile atomic_ullong* __obj, |
| 7784 | unsigned long long __desr, memory_order __o) |
| 7785 | { |
| 7786 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 7787 | } |
| 7788 | |
| 7789 | inline _LIBCPP_INLINE_VISIBILITY |
| 7790 | unsigned long long |
| 7791 | atomic_exchange_explicit(atomic_ullong* __obj, unsigned long long __desr, |
| 7792 | memory_order __o) |
| 7793 | { |
| 7794 | return atomic_exchange_explicit(const_cast<volatile atomic_ullong*> |
| 7795 | (__obj), __desr, __o); |
| 7796 | } |
| 7797 | |
| 7798 | inline _LIBCPP_INLINE_VISIBILITY |
| 7799 | bool |
| 7800 | atomic_compare_exchange_weak(volatile atomic_ullong* __obj, |
| 7801 | unsigned long long* __exp, |
| 7802 | unsigned long long __desr) |
| 7803 | { |
| 7804 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 7805 | memory_order_seq_cst, memory_order_seq_cst); |
| 7806 | } |
| 7807 | |
| 7808 | inline _LIBCPP_INLINE_VISIBILITY |
| 7809 | bool |
| 7810 | atomic_compare_exchange_weak(atomic_ullong* __obj, unsigned long long* __exp, |
| 7811 | unsigned long long __desr) |
| 7812 | { |
| 7813 | return atomic_compare_exchange_weak(const_cast<volatile atomic_ullong*> |
| 7814 | (__obj), __exp, __desr); |
| 7815 | } |
| 7816 | |
| 7817 | inline _LIBCPP_INLINE_VISIBILITY |
| 7818 | bool |
| 7819 | atomic_compare_exchange_strong(volatile atomic_ullong* __obj, |
| 7820 | unsigned long long* __exp, |
| 7821 | unsigned long long __desr) |
| 7822 | { |
| 7823 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 7824 | memory_order_seq_cst, memory_order_seq_cst); |
| 7825 | } |
| 7826 | |
| 7827 | inline _LIBCPP_INLINE_VISIBILITY |
| 7828 | bool |
| 7829 | atomic_compare_exchange_strong(atomic_ullong* __obj, unsigned long long* __exp, |
| 7830 | unsigned long long __desr) |
| 7831 | { |
| 7832 | return atomic_compare_exchange_strong(const_cast<volatile atomic_ullong*> |
| 7833 | (__obj), __exp, __desr); |
| 7834 | } |
| 7835 | |
| 7836 | inline _LIBCPP_INLINE_VISIBILITY |
| 7837 | bool |
| 7838 | atomic_compare_exchange_weak_explicit(volatile atomic_ullong* __obj, |
| 7839 | unsigned long long* __exp, |
| 7840 | unsigned long long __desr, |
| 7841 | memory_order __s, memory_order __f) |
| 7842 | { |
| 7843 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 7844 | __f); |
| 7845 | } |
| 7846 | |
| 7847 | inline _LIBCPP_INLINE_VISIBILITY |
| 7848 | bool |
| 7849 | atomic_compare_exchange_weak_explicit(atomic_ullong* __obj, |
| 7850 | unsigned long long* __exp, |
| 7851 | unsigned long long __desr, |
| 7852 | memory_order __s, memory_order __f) |
| 7853 | { |
| 7854 | return atomic_compare_exchange_weak_explicit( |
| 7855 | const_cast<volatile atomic_ullong*>(__obj), __exp, __desr, __s, __f); |
| 7856 | } |
| 7857 | |
| 7858 | inline _LIBCPP_INLINE_VISIBILITY |
| 7859 | bool |
| 7860 | atomic_compare_exchange_strong_explicit(volatile atomic_ullong* __obj, |
| 7861 | unsigned long long* __exp, |
| 7862 | unsigned long long __desr, |
| 7863 | memory_order __s, memory_order __f) |
| 7864 | { |
| 7865 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 7866 | __f); |
| 7867 | } |
| 7868 | |
| 7869 | inline _LIBCPP_INLINE_VISIBILITY |
| 7870 | bool |
| 7871 | atomic_compare_exchange_strong_explicit(atomic_ullong* __obj, |
| 7872 | unsigned long long* __exp, |
| 7873 | unsigned long long __desr, |
| 7874 | memory_order __s, memory_order __f) |
| 7875 | { |
| 7876 | return atomic_compare_exchange_strong_explicit( |
| 7877 | const_cast<volatile atomic_ullong*>(__obj), __exp, __desr, __s, __f); |
| 7878 | } |
| 7879 | |
| 7880 | inline _LIBCPP_INLINE_VISIBILITY |
| 7881 | unsigned long long |
| 7882 | atomic_fetch_add(volatile atomic_ullong* __obj, unsigned long long __v) |
| 7883 | { |
| 7884 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 7885 | } |
| 7886 | |
| 7887 | inline _LIBCPP_INLINE_VISIBILITY |
| 7888 | unsigned long long |
| 7889 | atomic_fetch_add(atomic_ullong* __obj, unsigned long long __v) |
| 7890 | { |
| 7891 | return atomic_fetch_add(const_cast<volatile atomic_ullong*>(__obj), __v); |
| 7892 | } |
| 7893 | |
| 7894 | inline _LIBCPP_INLINE_VISIBILITY |
| 7895 | unsigned long long |
| 7896 | atomic_fetch_add_explicit(volatile atomic_ullong* __obj, unsigned long long __v, |
| 7897 | memory_order __o) |
| 7898 | { |
| 7899 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 7900 | } |
| 7901 | |
| 7902 | inline _LIBCPP_INLINE_VISIBILITY |
| 7903 | unsigned long long |
| 7904 | atomic_fetch_add_explicit(atomic_ullong* __obj, unsigned long long __v, |
| 7905 | memory_order __o) |
| 7906 | { |
| 7907 | return atomic_fetch_add_explicit(const_cast<volatile atomic_ullong*>(__obj), |
| 7908 | __v, __o); |
| 7909 | } |
| 7910 | |
| 7911 | inline _LIBCPP_INLINE_VISIBILITY |
| 7912 | unsigned long long |
| 7913 | atomic_fetch_sub(volatile atomic_ullong* __obj, unsigned long long __v) |
| 7914 | { |
| 7915 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 7916 | } |
| 7917 | |
| 7918 | inline _LIBCPP_INLINE_VISIBILITY |
| 7919 | unsigned long long |
| 7920 | atomic_fetch_sub(atomic_ullong* __obj, unsigned long long __v) |
| 7921 | { |
| 7922 | return atomic_fetch_sub(const_cast<volatile atomic_ullong*>(__obj), __v); |
| 7923 | } |
| 7924 | |
| 7925 | inline _LIBCPP_INLINE_VISIBILITY |
| 7926 | unsigned long long |
| 7927 | atomic_fetch_sub_explicit(volatile atomic_ullong* __obj, unsigned long long __v, |
| 7928 | memory_order __o) |
| 7929 | { |
| 7930 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 7931 | } |
| 7932 | |
| 7933 | inline _LIBCPP_INLINE_VISIBILITY |
| 7934 | unsigned long long |
| 7935 | atomic_fetch_sub_explicit(atomic_ullong* __obj, unsigned long long __v, |
| 7936 | memory_order __o) |
| 7937 | { |
| 7938 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_ullong*>(__obj), |
| 7939 | __v, __o); |
| 7940 | } |
| 7941 | |
| 7942 | inline _LIBCPP_INLINE_VISIBILITY |
| 7943 | unsigned long long |
| 7944 | atomic_fetch_and(volatile atomic_ullong* __obj, unsigned long long __v) |
| 7945 | { |
| 7946 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 7947 | } |
| 7948 | |
| 7949 | inline _LIBCPP_INLINE_VISIBILITY |
| 7950 | unsigned long long |
| 7951 | atomic_fetch_and(atomic_ullong* __obj, unsigned long long __v) |
| 7952 | { |
| 7953 | return atomic_fetch_and(const_cast<volatile atomic_ullong*>(__obj), __v); |
| 7954 | } |
| 7955 | |
| 7956 | inline _LIBCPP_INLINE_VISIBILITY |
| 7957 | unsigned long long |
| 7958 | atomic_fetch_and_explicit(volatile atomic_ullong* __obj, unsigned long long __v, |
| 7959 | memory_order __o) |
| 7960 | { |
| 7961 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 7962 | } |
| 7963 | |
| 7964 | inline _LIBCPP_INLINE_VISIBILITY |
| 7965 | unsigned long long |
| 7966 | atomic_fetch_and_explicit(atomic_ullong* __obj, unsigned long long __v, |
| 7967 | memory_order __o) |
| 7968 | { |
| 7969 | return atomic_fetch_and_explicit(const_cast<volatile atomic_ullong*>(__obj), |
| 7970 | __v, __o); |
| 7971 | } |
| 7972 | |
| 7973 | inline _LIBCPP_INLINE_VISIBILITY |
| 7974 | unsigned long long |
| 7975 | atomic_fetch_or(volatile atomic_ullong* __obj, unsigned long long __v) |
| 7976 | { |
| 7977 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 7978 | } |
| 7979 | |
| 7980 | inline _LIBCPP_INLINE_VISIBILITY |
| 7981 | unsigned long long |
| 7982 | atomic_fetch_or(atomic_ullong* __obj, unsigned long long __v) |
| 7983 | { |
| 7984 | return atomic_fetch_or(const_cast<volatile atomic_ullong*>(__obj), __v); |
| 7985 | } |
| 7986 | |
| 7987 | inline _LIBCPP_INLINE_VISIBILITY |
| 7988 | unsigned long long |
| 7989 | atomic_fetch_or_explicit(volatile atomic_ullong* __obj, unsigned long long __v, |
| 7990 | memory_order __o) |
| 7991 | { |
| 7992 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 7993 | } |
| 7994 | |
| 7995 | inline _LIBCPP_INLINE_VISIBILITY |
| 7996 | unsigned long long |
| 7997 | atomic_fetch_or_explicit(atomic_ullong* __obj, unsigned long long __v, |
| 7998 | memory_order __o) |
| 7999 | { |
| 8000 | return atomic_fetch_or_explicit(const_cast<volatile atomic_ullong*>(__obj), |
| 8001 | __v, __o); |
| 8002 | } |
| 8003 | |
| 8004 | inline _LIBCPP_INLINE_VISIBILITY |
| 8005 | unsigned long long |
| 8006 | atomic_fetch_xor(volatile atomic_ullong* __obj, unsigned long long __v) |
| 8007 | { |
| 8008 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 8009 | } |
| 8010 | |
| 8011 | inline _LIBCPP_INLINE_VISIBILITY |
| 8012 | unsigned long long |
| 8013 | atomic_fetch_xor(atomic_ullong* __obj, unsigned long long __v) |
| 8014 | { |
| 8015 | return atomic_fetch_xor(const_cast<volatile atomic_ullong*>(__obj), __v); |
| 8016 | } |
| 8017 | |
| 8018 | inline _LIBCPP_INLINE_VISIBILITY |
| 8019 | unsigned long long |
| 8020 | atomic_fetch_xor_explicit(volatile atomic_ullong* __obj, unsigned long long __v, |
| 8021 | memory_order __o) |
| 8022 | { |
| 8023 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 8024 | } |
| 8025 | |
| 8026 | inline _LIBCPP_INLINE_VISIBILITY |
| 8027 | unsigned long long |
| 8028 | atomic_fetch_xor_explicit(atomic_ullong* __obj, unsigned long long __v, |
| 8029 | memory_order __o) |
| 8030 | { |
| 8031 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_ullong*>(__obj), |
| 8032 | __v, __o); |
| 8033 | } |
| 8034 | |
| 8035 | #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS |
| 8036 | |
| 8037 | // atomic_char16_t |
| 8038 | |
| 8039 | struct atomic_char16_t; |
| 8040 | |
| 8041 | bool atomic_is_lock_free(const volatile atomic_char16_t*); |
| 8042 | bool atomic_is_lock_free(const atomic_char16_t*); |
| 8043 | void atomic_init(volatile atomic_char16_t*, char16_t); |
| 8044 | void atomic_init(atomic_char16_t*, char16_t); |
| 8045 | void atomic_store(volatile atomic_char16_t*, char16_t); |
| 8046 | void atomic_store(atomic_char16_t*, char16_t); |
| 8047 | void atomic_store_explicit(volatile atomic_char16_t*, char16_t, memory_order); |
| 8048 | void atomic_store_explicit(atomic_char16_t*, char16_t, memory_order); |
| 8049 | char16_t atomic_load(const volatile atomic_char16_t*); |
| 8050 | char16_t atomic_load(const atomic_char16_t*); |
| 8051 | char16_t atomic_load_explicit(const volatile atomic_char16_t*, memory_order); |
| 8052 | char16_t atomic_load_explicit(const atomic_char16_t*, memory_order); |
| 8053 | char16_t atomic_exchange(volatile atomic_char16_t*, char16_t); |
| 8054 | char16_t atomic_exchange(atomic_char16_t*, char16_t); |
| 8055 | char16_t atomic_exchange_explicit(volatile atomic_char16_t*, char16_t, |
| 8056 | memory_order); |
| 8057 | char16_t atomic_exchange_explicit(atomic_char16_t*, char16_t, memory_order); |
| 8058 | bool atomic_compare_exchange_weak(volatile atomic_char16_t*, char16_t*, |
| 8059 | char16_t); |
| 8060 | bool atomic_compare_exchange_weak(atomic_char16_t*, char16_t*, char16_t); |
| 8061 | bool atomic_compare_exchange_strong(volatile atomic_char16_t*, char16_t*, |
| 8062 | char16_t); |
| 8063 | bool atomic_compare_exchange_strong(atomic_char16_t*, char16_t*, char16_t); |
| 8064 | bool atomic_compare_exchange_weak_explicit(volatile atomic_char16_t*, char16_t*, |
| 8065 | char16_t, memory_order, |
| 8066 | memory_order); |
| 8067 | bool atomic_compare_exchange_weak_explicit(atomic_char16_t*, char16_t*, |
| 8068 | char16_t, memory_order, |
| 8069 | memory_order); |
| 8070 | bool atomic_compare_exchange_strong_explicit(volatile atomic_char16_t*, |
| 8071 | char16_t*, char16_t, memory_order, |
| 8072 | memory_order); |
| 8073 | bool atomic_compare_exchange_strong_explicit(atomic_char16_t*, char16_t*, |
| 8074 | char16_t, memory_order, |
| 8075 | memory_order); |
| 8076 | char16_t atomic_fetch_add(volatile atomic_char16_t*, char16_t); |
| 8077 | char16_t atomic_fetch_add(atomic_char16_t*, char16_t); |
| 8078 | char16_t atomic_fetch_add_explicit(volatile atomic_char16_t*, char16_t, |
| 8079 | memory_order); |
| 8080 | char16_t atomic_fetch_add_explicit(atomic_char16_t*, char16_t, memory_order); |
| 8081 | char16_t atomic_fetch_sub(volatile atomic_char16_t*, char16_t); |
| 8082 | char16_t atomic_fetch_sub(atomic_char16_t*, char16_t); |
| 8083 | char16_t atomic_fetch_sub_explicit(volatile atomic_char16_t*, char16_t, |
| 8084 | memory_order); |
| 8085 | char16_t atomic_fetch_sub_explicit(atomic_char16_t*, char16_t, memory_order); |
| 8086 | char16_t atomic_fetch_and(volatile atomic_char16_t*, char16_t); |
| 8087 | char16_t atomic_fetch_and(atomic_char16_t*, char16_t); |
| 8088 | char16_t atomic_fetch_and_explicit(volatile atomic_char16_t*, char16_t, |
| 8089 | memory_order); |
| 8090 | char16_t atomic_fetch_and_explicit(atomic_char16_t*, char16_t, memory_order); |
| 8091 | char16_t atomic_fetch_or(volatile atomic_char16_t*, char16_t); |
| 8092 | char16_t atomic_fetch_or(atomic_char16_t*, char16_t); |
| 8093 | char16_t atomic_fetch_or_explicit(volatile atomic_char16_t*, char16_t, |
| 8094 | memory_order); |
| 8095 | char16_t atomic_fetch_or_explicit(atomic_char16_t*, char16_t, memory_order); |
| 8096 | char16_t atomic_fetch_xor(volatile atomic_char16_t*, char16_t); |
| 8097 | char16_t atomic_fetch_xor(atomic_char16_t*, char16_t); |
| 8098 | char16_t atomic_fetch_xor_explicit(volatile atomic_char16_t*, char16_t, |
| 8099 | memory_order); |
| 8100 | char16_t atomic_fetch_xor_explicit(atomic_char16_t*, char16_t, memory_order); |
| 8101 | |
| 8102 | typedef struct atomic_char16_t |
| 8103 | { |
| 8104 | char16_t __v_; |
| 8105 | |
| 8106 | _LIBCPP_INLINE_VISIBILITY |
| 8107 | bool is_lock_free() const volatile |
| 8108 | {return atomic_is_lock_free(this);} |
| 8109 | _LIBCPP_INLINE_VISIBILITY |
| 8110 | bool is_lock_free() const |
| 8111 | {return atomic_is_lock_free(this);} |
| 8112 | _LIBCPP_INLINE_VISIBILITY |
| 8113 | void store(char16_t __v, memory_order __o = memory_order_seq_cst) volatile |
| 8114 | {atomic_store_explicit(this, __v, __o);} |
| 8115 | _LIBCPP_INLINE_VISIBILITY |
| 8116 | void store(char16_t __v, memory_order __o = memory_order_seq_cst) |
| 8117 | {atomic_store_explicit(this, __v, __o);} |
| 8118 | _LIBCPP_INLINE_VISIBILITY |
| 8119 | char16_t load(memory_order __o = memory_order_seq_cst) const volatile |
| 8120 | {return atomic_load_explicit(this, __o);} |
| 8121 | _LIBCPP_INLINE_VISIBILITY |
| 8122 | char16_t load(memory_order __o = memory_order_seq_cst) const |
| 8123 | {return atomic_load_explicit(this, __o);} |
| 8124 | _LIBCPP_INLINE_VISIBILITY |
| 8125 | operator char16_t() const volatile |
| 8126 | {return load();} |
| 8127 | _LIBCPP_INLINE_VISIBILITY |
| 8128 | operator char16_t() const |
| 8129 | {return load();} |
| 8130 | _LIBCPP_INLINE_VISIBILITY |
| 8131 | char16_t exchange(char16_t __v, |
| 8132 | memory_order __o = memory_order_seq_cst) volatile |
| 8133 | {return atomic_exchange_explicit(this, __v, __o);} |
| 8134 | _LIBCPP_INLINE_VISIBILITY |
| 8135 | char16_t exchange(char16_t __v, memory_order __o = memory_order_seq_cst) |
| 8136 | {return atomic_exchange_explicit(this, __v, __o);} |
| 8137 | _LIBCPP_INLINE_VISIBILITY |
| 8138 | bool compare_exchange_weak(char16_t& __v, char16_t __e, memory_order __s, |
| 8139 | memory_order __f) volatile |
| 8140 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 8141 | __f);} |
| 8142 | _LIBCPP_INLINE_VISIBILITY |
| 8143 | bool compare_exchange_weak(char16_t& __v, char16_t __e, memory_order __s, |
| 8144 | memory_order __f) |
| 8145 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 8146 | __f);} |
| 8147 | _LIBCPP_INLINE_VISIBILITY |
| 8148 | bool compare_exchange_strong(char16_t& __v, char16_t __e, memory_order __s, |
| 8149 | memory_order __f) volatile |
| 8150 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 8151 | __f);} |
| 8152 | _LIBCPP_INLINE_VISIBILITY |
| 8153 | bool compare_exchange_strong(char16_t& __v, char16_t __e, memory_order __s, |
| 8154 | memory_order __f) |
| 8155 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 8156 | __f);} |
| 8157 | _LIBCPP_INLINE_VISIBILITY |
| 8158 | bool compare_exchange_weak(char16_t& __v, char16_t __e, |
| 8159 | memory_order __s = memory_order_seq_cst) volatile |
| 8160 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 8161 | __translate_memory_order(__s));} |
| 8162 | _LIBCPP_INLINE_VISIBILITY |
| 8163 | bool compare_exchange_weak(char16_t& __v, char16_t __e, |
| 8164 | memory_order __s = memory_order_seq_cst) |
| 8165 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 8166 | __translate_memory_order(__s));} |
| 8167 | _LIBCPP_INLINE_VISIBILITY |
| 8168 | bool compare_exchange_strong(char16_t& __v, char16_t __e, |
| 8169 | memory_order __s = memory_order_seq_cst) volatile |
| 8170 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 8171 | __translate_memory_order(__s));} |
| 8172 | _LIBCPP_INLINE_VISIBILITY |
| 8173 | bool compare_exchange_strong(char16_t& __v, char16_t __e, |
| 8174 | memory_order __s = memory_order_seq_cst) |
| 8175 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 8176 | __translate_memory_order(__s));} |
| 8177 | _LIBCPP_INLINE_VISIBILITY |
| 8178 | char16_t fetch_add(char16_t __v, |
| 8179 | memory_order __o = memory_order_seq_cst) volatile |
| 8180 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 8181 | _LIBCPP_INLINE_VISIBILITY |
| 8182 | char16_t fetch_add(char16_t __v, memory_order __o = memory_order_seq_cst) |
| 8183 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 8184 | _LIBCPP_INLINE_VISIBILITY |
| 8185 | char16_t fetch_sub(char16_t __v, |
| 8186 | memory_order __o = memory_order_seq_cst) volatile |
| 8187 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 8188 | _LIBCPP_INLINE_VISIBILITY |
| 8189 | char16_t fetch_sub(char16_t __v, memory_order __o = memory_order_seq_cst) |
| 8190 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 8191 | _LIBCPP_INLINE_VISIBILITY |
| 8192 | char16_t fetch_and(char16_t __v, |
| 8193 | memory_order __o = memory_order_seq_cst) volatile |
| 8194 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 8195 | _LIBCPP_INLINE_VISIBILITY |
| 8196 | char16_t fetch_and(char16_t __v, memory_order __o = memory_order_seq_cst) |
| 8197 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 8198 | _LIBCPP_INLINE_VISIBILITY |
| 8199 | char16_t fetch_or(char16_t __v, |
| 8200 | memory_order __o = memory_order_seq_cst) volatile |
| 8201 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 8202 | _LIBCPP_INLINE_VISIBILITY |
| 8203 | char16_t fetch_or(char16_t __v, memory_order __o = memory_order_seq_cst) |
| 8204 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 8205 | _LIBCPP_INLINE_VISIBILITY |
| 8206 | char16_t fetch_xor(char16_t __v, |
| 8207 | memory_order __o = memory_order_seq_cst) volatile |
| 8208 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 8209 | _LIBCPP_INLINE_VISIBILITY |
| 8210 | char16_t fetch_xor(char16_t __v, memory_order __o = memory_order_seq_cst) |
| 8211 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 8212 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 8213 | atomic_char16_t() = default; |
| 8214 | #else |
| 8215 | _LIBCPP_INLINE_VISIBILITY |
| 8216 | atomic_char16_t() {} |
| 8217 | #endif |
| 8218 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 8219 | constexpr atomic_char16_t(char16_t __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 8220 | : __v_(__v) {} |
| 8221 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 8222 | atomic_char16_t(const atomic_char16_t&) = delete; |
| 8223 | atomic_char16_t& operator=(const atomic_char16_t&) = delete; |
| 8224 | atomic_char16_t& operator=(const atomic_char16_t&) volatile = delete; |
| 8225 | #else |
| 8226 | private: |
| 8227 | atomic_char16_t(const atomic_char16_t&); |
| 8228 | atomic_char16_t& operator=(const atomic_char16_t&); |
| 8229 | atomic_char16_t& operator=(const atomic_char16_t&) volatile; |
| 8230 | public: |
| 8231 | #endif |
| 8232 | _LIBCPP_INLINE_VISIBILITY |
| 8233 | char16_t operator=(char16_t __v) volatile |
| 8234 | {store(__v); return __v;} |
| 8235 | _LIBCPP_INLINE_VISIBILITY |
| 8236 | char16_t operator=(char16_t __v) |
| 8237 | {store(__v); return __v;} |
| 8238 | _LIBCPP_INLINE_VISIBILITY |
| 8239 | char16_t operator++(int) volatile |
| 8240 | {return fetch_add(char16_t(1));} |
| 8241 | _LIBCPP_INLINE_VISIBILITY |
| 8242 | char16_t operator++(int) |
| 8243 | {return fetch_add(char16_t(1));} |
| 8244 | _LIBCPP_INLINE_VISIBILITY |
| 8245 | char16_t operator--(int) volatile |
| 8246 | {return fetch_sub(char16_t(1));} |
| 8247 | _LIBCPP_INLINE_VISIBILITY |
| 8248 | char16_t operator--(int) |
| 8249 | {return fetch_sub(char16_t(1));} |
| 8250 | _LIBCPP_INLINE_VISIBILITY |
| 8251 | char16_t operator++() volatile |
| 8252 | {return char16_t(fetch_add(char16_t(1)) + 1);} |
| 8253 | _LIBCPP_INLINE_VISIBILITY |
| 8254 | char16_t operator++() |
| 8255 | {return char16_t(fetch_add(char16_t(1)) + 1);} |
| 8256 | _LIBCPP_INLINE_VISIBILITY |
| 8257 | char16_t operator--() volatile |
| 8258 | {return char16_t(fetch_sub(char16_t(1)) - 1);} |
| 8259 | _LIBCPP_INLINE_VISIBILITY |
| 8260 | char16_t operator--() |
| 8261 | {return char16_t(fetch_sub(char16_t(1)) - 1);} |
| 8262 | _LIBCPP_INLINE_VISIBILITY |
| 8263 | char16_t operator+=(char16_t __v) volatile |
| 8264 | {return char16_t(fetch_add(__v) + __v);} |
| 8265 | _LIBCPP_INLINE_VISIBILITY |
| 8266 | char16_t operator+=(char16_t __v) |
| 8267 | {return char16_t(fetch_add(__v) + __v);} |
| 8268 | _LIBCPP_INLINE_VISIBILITY |
| 8269 | char16_t operator-=(char16_t __v) volatile |
| 8270 | {return char16_t(fetch_sub(__v) - __v);} |
| 8271 | _LIBCPP_INLINE_VISIBILITY |
| 8272 | char16_t operator-=(char16_t __v) |
| 8273 | {return char16_t(fetch_sub(__v) - __v);} |
| 8274 | _LIBCPP_INLINE_VISIBILITY |
| 8275 | char16_t operator&=(char16_t __v) volatile |
| 8276 | {return char16_t(fetch_and(__v) & __v);} |
| 8277 | _LIBCPP_INLINE_VISIBILITY |
| 8278 | char16_t operator&=(char16_t __v) |
| 8279 | {return char16_t(fetch_and(__v) & __v);} |
| 8280 | _LIBCPP_INLINE_VISIBILITY |
| 8281 | char16_t operator|=(char16_t __v) volatile |
| 8282 | {return char16_t(fetch_or(__v) | __v);} |
| 8283 | _LIBCPP_INLINE_VISIBILITY |
| 8284 | char16_t operator|=(char16_t __v) |
| 8285 | {return char16_t(fetch_or(__v) | __v);} |
| 8286 | _LIBCPP_INLINE_VISIBILITY |
| 8287 | char16_t operator^=(char16_t __v) volatile |
| 8288 | {return char16_t(fetch_xor(__v) ^ __v);} |
| 8289 | _LIBCPP_INLINE_VISIBILITY |
| 8290 | char16_t operator^=(char16_t __v) |
| 8291 | {return char16_t(fetch_xor(__v) ^ __v);} |
| 8292 | } atomic_char16_t; |
| 8293 | |
| 8294 | inline _LIBCPP_INLINE_VISIBILITY |
| 8295 | bool |
| 8296 | atomic_is_lock_free(const volatile atomic_char16_t*) |
| 8297 | { |
| 8298 | typedef char16_t type; |
| 8299 | return __atomic_is_lock_free(type); |
| 8300 | } |
| 8301 | |
| 8302 | inline _LIBCPP_INLINE_VISIBILITY |
| 8303 | bool |
| 8304 | atomic_is_lock_free(const atomic_char16_t* __obj) |
| 8305 | { |
| 8306 | return atomic_is_lock_free(const_cast<volatile atomic_char16_t*>(__obj)); |
| 8307 | } |
| 8308 | |
| 8309 | inline _LIBCPP_INLINE_VISIBILITY |
| 8310 | void |
| 8311 | atomic_init(volatile atomic_char16_t* __obj, char16_t __desr) |
| 8312 | { |
| 8313 | __obj->__v_ = __desr; |
| 8314 | } |
| 8315 | |
| 8316 | inline _LIBCPP_INLINE_VISIBILITY |
| 8317 | void |
| 8318 | atomic_init(atomic_char16_t* __obj, char16_t __desr) |
| 8319 | { |
| 8320 | __obj->__v_ = __desr; |
| 8321 | } |
| 8322 | |
| 8323 | inline _LIBCPP_INLINE_VISIBILITY |
| 8324 | void |
| 8325 | atomic_store(volatile atomic_char16_t* __obj, char16_t __desr) |
| 8326 | { |
| 8327 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 8328 | } |
| 8329 | |
| 8330 | inline _LIBCPP_INLINE_VISIBILITY |
| 8331 | void |
| 8332 | atomic_store(atomic_char16_t* __obj, char16_t __desr) |
| 8333 | { |
| 8334 | atomic_store(const_cast<volatile atomic_char16_t*>(__obj), __desr); |
| 8335 | } |
| 8336 | |
| 8337 | inline _LIBCPP_INLINE_VISIBILITY |
| 8338 | void |
| 8339 | atomic_store_explicit(volatile atomic_char16_t* __obj, char16_t __desr, |
| 8340 | memory_order __o) |
| 8341 | { |
| 8342 | __atomic_store(&__obj->__v_, __desr, __o); |
| 8343 | } |
| 8344 | |
| 8345 | inline _LIBCPP_INLINE_VISIBILITY |
| 8346 | void |
| 8347 | atomic_store_explicit(atomic_char16_t* __obj, char16_t __desr, memory_order __o) |
| 8348 | { |
| 8349 | atomic_store_explicit(const_cast<volatile atomic_char16_t*>(__obj), __desr, |
| 8350 | __o); |
| 8351 | } |
| 8352 | |
| 8353 | inline _LIBCPP_INLINE_VISIBILITY |
| 8354 | char16_t |
| 8355 | atomic_load(const volatile atomic_char16_t* __obj) |
| 8356 | { |
| 8357 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 8358 | } |
| 8359 | |
| 8360 | inline _LIBCPP_INLINE_VISIBILITY |
| 8361 | char16_t |
| 8362 | atomic_load(const atomic_char16_t* __obj) |
| 8363 | { |
| 8364 | return atomic_load(const_cast<const volatile atomic_char16_t*>(__obj)); |
| 8365 | } |
| 8366 | |
| 8367 | inline _LIBCPP_INLINE_VISIBILITY |
| 8368 | char16_t |
| 8369 | atomic_load_explicit(const volatile atomic_char16_t* __obj, memory_order __o) |
| 8370 | { |
| 8371 | return __atomic_load(&__obj->__v_, __o); |
| 8372 | } |
| 8373 | |
| 8374 | inline _LIBCPP_INLINE_VISIBILITY |
| 8375 | char16_t |
| 8376 | atomic_load_explicit(const atomic_char16_t* __obj, memory_order __o) |
| 8377 | { |
| 8378 | return atomic_load_explicit(const_cast<const volatile atomic_char16_t*> |
| 8379 | (__obj), __o); |
| 8380 | } |
| 8381 | |
| 8382 | inline _LIBCPP_INLINE_VISIBILITY |
| 8383 | char16_t |
| 8384 | atomic_exchange(volatile atomic_char16_t* __obj, char16_t __desr) |
| 8385 | { |
| 8386 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 8387 | } |
| 8388 | |
| 8389 | inline _LIBCPP_INLINE_VISIBILITY |
| 8390 | char16_t |
| 8391 | atomic_exchange(atomic_char16_t* __obj, char16_t __desr) |
| 8392 | { |
| 8393 | return atomic_exchange(const_cast<volatile atomic_char16_t*>(__obj), __desr); |
| 8394 | } |
| 8395 | |
| 8396 | inline _LIBCPP_INLINE_VISIBILITY |
| 8397 | char16_t |
| 8398 | atomic_exchange_explicit(volatile atomic_char16_t* __obj, char16_t __desr, |
| 8399 | memory_order __o) |
| 8400 | { |
| 8401 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 8402 | } |
| 8403 | |
| 8404 | inline _LIBCPP_INLINE_VISIBILITY |
| 8405 | char16_t |
| 8406 | atomic_exchange_explicit(atomic_char16_t* __obj, char16_t __desr, |
| 8407 | memory_order __o) |
| 8408 | { |
| 8409 | return atomic_exchange_explicit(const_cast<volatile atomic_char16_t*> |
| 8410 | (__obj), __desr, __o); |
| 8411 | } |
| 8412 | |
| 8413 | inline _LIBCPP_INLINE_VISIBILITY |
| 8414 | bool |
| 8415 | atomic_compare_exchange_weak(volatile atomic_char16_t* __obj, char16_t* __exp, |
| 8416 | char16_t __desr) |
| 8417 | { |
| 8418 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 8419 | memory_order_seq_cst, memory_order_seq_cst); |
| 8420 | } |
| 8421 | |
| 8422 | inline _LIBCPP_INLINE_VISIBILITY |
| 8423 | bool |
| 8424 | atomic_compare_exchange_weak(atomic_char16_t* __obj, char16_t* __exp, |
| 8425 | char16_t __desr) |
| 8426 | { |
| 8427 | return atomic_compare_exchange_weak(const_cast<volatile atomic_char16_t*> |
| 8428 | (__obj), __exp, __desr); |
| 8429 | } |
| 8430 | |
| 8431 | inline _LIBCPP_INLINE_VISIBILITY |
| 8432 | bool |
| 8433 | atomic_compare_exchange_strong(volatile atomic_char16_t* __obj, char16_t* __exp, |
| 8434 | char16_t __desr) |
| 8435 | { |
| 8436 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 8437 | memory_order_seq_cst, memory_order_seq_cst); |
| 8438 | } |
| 8439 | |
| 8440 | inline _LIBCPP_INLINE_VISIBILITY |
| 8441 | bool |
| 8442 | atomic_compare_exchange_strong(atomic_char16_t* __obj, char16_t* __exp, |
| 8443 | char16_t __desr) |
| 8444 | { |
| 8445 | return atomic_compare_exchange_strong(const_cast<volatile atomic_char16_t*> |
| 8446 | (__obj), __exp, __desr); |
| 8447 | } |
| 8448 | |
| 8449 | inline _LIBCPP_INLINE_VISIBILITY |
| 8450 | bool |
| 8451 | atomic_compare_exchange_weak_explicit(volatile atomic_char16_t* __obj, |
| 8452 | char16_t* __exp, char16_t __desr, |
| 8453 | memory_order __s, memory_order __f) |
| 8454 | { |
| 8455 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 8456 | __f); |
| 8457 | } |
| 8458 | |
| 8459 | inline _LIBCPP_INLINE_VISIBILITY |
| 8460 | bool |
| 8461 | atomic_compare_exchange_weak_explicit(atomic_char16_t* __obj, char16_t* __exp, |
| 8462 | char16_t __desr, memory_order __s, |
| 8463 | memory_order __f) |
| 8464 | { |
| 8465 | return atomic_compare_exchange_weak_explicit( |
| 8466 | const_cast<volatile atomic_char16_t*>(__obj), __exp, __desr, __s, __f); |
| 8467 | } |
| 8468 | |
| 8469 | inline _LIBCPP_INLINE_VISIBILITY |
| 8470 | bool |
| 8471 | atomic_compare_exchange_strong_explicit(volatile atomic_char16_t* __obj, |
| 8472 | char16_t* __exp, char16_t __desr, |
| 8473 | memory_order __s, memory_order __f) |
| 8474 | { |
| 8475 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 8476 | __f); |
| 8477 | } |
| 8478 | |
| 8479 | inline _LIBCPP_INLINE_VISIBILITY |
| 8480 | bool |
| 8481 | atomic_compare_exchange_strong_explicit(atomic_char16_t* __obj, char16_t* __exp, |
| 8482 | char16_t __desr, memory_order __s, |
| 8483 | memory_order __f) |
| 8484 | { |
| 8485 | return atomic_compare_exchange_strong_explicit( |
| 8486 | const_cast<volatile atomic_char16_t*>(__obj), __exp, __desr, __s, __f); |
| 8487 | } |
| 8488 | |
| 8489 | inline _LIBCPP_INLINE_VISIBILITY |
| 8490 | char16_t |
| 8491 | atomic_fetch_add(volatile atomic_char16_t* __obj, char16_t __v) |
| 8492 | { |
| 8493 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 8494 | } |
| 8495 | |
| 8496 | inline _LIBCPP_INLINE_VISIBILITY |
| 8497 | char16_t |
| 8498 | atomic_fetch_add(atomic_char16_t* __obj, char16_t __v) |
| 8499 | { |
| 8500 | return atomic_fetch_add(const_cast<volatile atomic_char16_t*>(__obj), __v); |
| 8501 | } |
| 8502 | |
| 8503 | inline _LIBCPP_INLINE_VISIBILITY |
| 8504 | char16_t |
| 8505 | atomic_fetch_add_explicit(volatile atomic_char16_t* __obj, char16_t __v, |
| 8506 | memory_order __o) |
| 8507 | { |
| 8508 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 8509 | } |
| 8510 | |
| 8511 | inline _LIBCPP_INLINE_VISIBILITY |
| 8512 | char16_t |
| 8513 | atomic_fetch_add_explicit(atomic_char16_t* __obj, char16_t __v, |
| 8514 | memory_order __o) |
| 8515 | { |
| 8516 | return atomic_fetch_add_explicit(const_cast<volatile atomic_char16_t*>(__obj), |
| 8517 | __v, __o); |
| 8518 | } |
| 8519 | |
| 8520 | inline _LIBCPP_INLINE_VISIBILITY |
| 8521 | char16_t |
| 8522 | atomic_fetch_sub(volatile atomic_char16_t* __obj, char16_t __v) |
| 8523 | { |
| 8524 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 8525 | } |
| 8526 | |
| 8527 | inline _LIBCPP_INLINE_VISIBILITY |
| 8528 | char16_t |
| 8529 | atomic_fetch_sub(atomic_char16_t* __obj, char16_t __v) |
| 8530 | { |
| 8531 | return atomic_fetch_sub(const_cast<volatile atomic_char16_t*>(__obj), __v); |
| 8532 | } |
| 8533 | |
| 8534 | inline _LIBCPP_INLINE_VISIBILITY |
| 8535 | char16_t |
| 8536 | atomic_fetch_sub_explicit(volatile atomic_char16_t* __obj, char16_t __v, |
| 8537 | memory_order __o) |
| 8538 | { |
| 8539 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 8540 | } |
| 8541 | |
| 8542 | inline _LIBCPP_INLINE_VISIBILITY |
| 8543 | char16_t |
| 8544 | atomic_fetch_sub_explicit(atomic_char16_t* __obj, char16_t __v, |
| 8545 | memory_order __o) |
| 8546 | { |
| 8547 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_char16_t*>(__obj), |
| 8548 | __v, __o); |
| 8549 | } |
| 8550 | |
| 8551 | inline _LIBCPP_INLINE_VISIBILITY |
| 8552 | char16_t |
| 8553 | atomic_fetch_and(volatile atomic_char16_t* __obj, char16_t __v) |
| 8554 | { |
| 8555 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 8556 | } |
| 8557 | |
| 8558 | inline _LIBCPP_INLINE_VISIBILITY |
| 8559 | char16_t |
| 8560 | atomic_fetch_and(atomic_char16_t* __obj, char16_t __v) |
| 8561 | { |
| 8562 | return atomic_fetch_and(const_cast<volatile atomic_char16_t*>(__obj), __v); |
| 8563 | } |
| 8564 | |
| 8565 | inline _LIBCPP_INLINE_VISIBILITY |
| 8566 | char16_t |
| 8567 | atomic_fetch_and_explicit(volatile atomic_char16_t* __obj, char16_t __v, |
| 8568 | memory_order __o) |
| 8569 | { |
| 8570 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 8571 | } |
| 8572 | |
| 8573 | inline _LIBCPP_INLINE_VISIBILITY |
| 8574 | char16_t |
| 8575 | atomic_fetch_and_explicit(atomic_char16_t* __obj, char16_t __v, |
| 8576 | memory_order __o) |
| 8577 | { |
| 8578 | return atomic_fetch_and_explicit(const_cast<volatile atomic_char16_t*>(__obj), |
| 8579 | __v, __o); |
| 8580 | } |
| 8581 | |
| 8582 | inline _LIBCPP_INLINE_VISIBILITY |
| 8583 | char16_t |
| 8584 | atomic_fetch_or(volatile atomic_char16_t* __obj, char16_t __v) |
| 8585 | { |
| 8586 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 8587 | } |
| 8588 | |
| 8589 | inline _LIBCPP_INLINE_VISIBILITY |
| 8590 | char16_t |
| 8591 | atomic_fetch_or(atomic_char16_t* __obj, char16_t __v) |
| 8592 | { |
| 8593 | return atomic_fetch_or(const_cast<volatile atomic_char16_t*>(__obj), __v); |
| 8594 | } |
| 8595 | |
| 8596 | inline _LIBCPP_INLINE_VISIBILITY |
| 8597 | char16_t |
| 8598 | atomic_fetch_or_explicit(volatile atomic_char16_t* __obj, char16_t __v, |
| 8599 | memory_order __o) |
| 8600 | { |
| 8601 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 8602 | } |
| 8603 | |
| 8604 | inline _LIBCPP_INLINE_VISIBILITY |
| 8605 | char16_t |
| 8606 | atomic_fetch_or_explicit(atomic_char16_t* __obj, char16_t __v, memory_order __o) |
| 8607 | { |
| 8608 | return atomic_fetch_or_explicit(const_cast<volatile atomic_char16_t*>(__obj), |
| 8609 | __v, __o); |
| 8610 | } |
| 8611 | |
| 8612 | inline _LIBCPP_INLINE_VISIBILITY |
| 8613 | char16_t |
| 8614 | atomic_fetch_xor(volatile atomic_char16_t* __obj, char16_t __v) |
| 8615 | { |
| 8616 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 8617 | } |
| 8618 | |
| 8619 | inline _LIBCPP_INLINE_VISIBILITY |
| 8620 | char16_t |
| 8621 | atomic_fetch_xor(atomic_char16_t* __obj, char16_t __v) |
| 8622 | { |
| 8623 | return atomic_fetch_xor(const_cast<volatile atomic_char16_t*>(__obj), __v); |
| 8624 | } |
| 8625 | |
| 8626 | inline _LIBCPP_INLINE_VISIBILITY |
| 8627 | char16_t |
| 8628 | atomic_fetch_xor_explicit(volatile atomic_char16_t* __obj, char16_t __v, |
| 8629 | memory_order __o) |
| 8630 | { |
| 8631 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 8632 | } |
| 8633 | |
| 8634 | inline _LIBCPP_INLINE_VISIBILITY |
| 8635 | char16_t |
| 8636 | atomic_fetch_xor_explicit(atomic_char16_t* __obj, char16_t __v, |
| 8637 | memory_order __o) |
| 8638 | { |
| 8639 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_char16_t*>(__obj), |
| 8640 | __v, __o); |
| 8641 | } |
| 8642 | |
| 8643 | // atomic_char32_t |
| 8644 | |
| 8645 | struct atomic_char32_t; |
| 8646 | |
| 8647 | bool atomic_is_lock_free(const volatile atomic_char32_t*); |
| 8648 | bool atomic_is_lock_free(const atomic_char32_t*); |
| 8649 | void atomic_init(volatile atomic_char32_t*, char32_t); |
| 8650 | void atomic_init(atomic_char32_t*, char32_t); |
| 8651 | void atomic_store(volatile atomic_char32_t*, char32_t); |
| 8652 | void atomic_store(atomic_char32_t*, char32_t); |
| 8653 | void atomic_store_explicit(volatile atomic_char32_t*, char32_t, memory_order); |
| 8654 | void atomic_store_explicit(atomic_char32_t*, char32_t, memory_order); |
| 8655 | char32_t atomic_load(const volatile atomic_char32_t*); |
| 8656 | char32_t atomic_load(const atomic_char32_t*); |
| 8657 | char32_t atomic_load_explicit(const volatile atomic_char32_t*, memory_order); |
| 8658 | char32_t atomic_load_explicit(const atomic_char32_t*, memory_order); |
| 8659 | char32_t atomic_exchange(volatile atomic_char32_t*, char32_t); |
| 8660 | char32_t atomic_exchange(atomic_char32_t*, char32_t); |
| 8661 | char32_t atomic_exchange_explicit(volatile atomic_char32_t*, char32_t, |
| 8662 | memory_order); |
| 8663 | char32_t atomic_exchange_explicit(atomic_char32_t*, char32_t, memory_order); |
| 8664 | bool atomic_compare_exchange_weak(volatile atomic_char32_t*, char32_t*, |
| 8665 | char32_t); |
| 8666 | bool atomic_compare_exchange_weak(atomic_char32_t*, char32_t*, char32_t); |
| 8667 | bool atomic_compare_exchange_strong(volatile atomic_char32_t*, char32_t*, |
| 8668 | char32_t); |
| 8669 | bool atomic_compare_exchange_strong(atomic_char32_t*, char32_t*, char32_t); |
| 8670 | bool atomic_compare_exchange_weak_explicit(volatile atomic_char32_t*, char32_t*, |
| 8671 | char32_t, memory_order, |
| 8672 | memory_order); |
| 8673 | bool atomic_compare_exchange_weak_explicit(atomic_char32_t*, char32_t*, |
| 8674 | char32_t, memory_order, |
| 8675 | memory_order); |
| 8676 | bool atomic_compare_exchange_strong_explicit(volatile atomic_char32_t*, |
| 8677 | char32_t*, char32_t, memory_order, |
| 8678 | memory_order); |
| 8679 | bool atomic_compare_exchange_strong_explicit(atomic_char32_t*, char32_t*, |
| 8680 | char32_t, memory_order, |
| 8681 | memory_order); |
| 8682 | char32_t atomic_fetch_add(volatile atomic_char32_t*, char32_t); |
| 8683 | char32_t atomic_fetch_add(atomic_char32_t*, char32_t); |
| 8684 | char32_t atomic_fetch_add_explicit(volatile atomic_char32_t*, char32_t, |
| 8685 | memory_order); |
| 8686 | char32_t atomic_fetch_add_explicit(atomic_char32_t*, char32_t, memory_order); |
| 8687 | char32_t atomic_fetch_sub(volatile atomic_char32_t*, char32_t); |
| 8688 | char32_t atomic_fetch_sub(atomic_char32_t*, char32_t); |
| 8689 | char32_t atomic_fetch_sub_explicit(volatile atomic_char32_t*, char32_t, |
| 8690 | memory_order); |
| 8691 | char32_t atomic_fetch_sub_explicit(atomic_char32_t*, char32_t, memory_order); |
| 8692 | char32_t atomic_fetch_and(volatile atomic_char32_t*, char32_t); |
| 8693 | char32_t atomic_fetch_and(atomic_char32_t*, char32_t); |
| 8694 | char32_t atomic_fetch_and_explicit(volatile atomic_char32_t*, char32_t, |
| 8695 | memory_order); |
| 8696 | char32_t atomic_fetch_and_explicit(atomic_char32_t*, char32_t, memory_order); |
| 8697 | char32_t atomic_fetch_or(volatile atomic_char32_t*, char32_t); |
| 8698 | char32_t atomic_fetch_or(atomic_char32_t*, char32_t); |
| 8699 | char32_t atomic_fetch_or_explicit(volatile atomic_char32_t*, char32_t, |
| 8700 | memory_order); |
| 8701 | char32_t atomic_fetch_or_explicit(atomic_char32_t*, char32_t, memory_order); |
| 8702 | char32_t atomic_fetch_xor(volatile atomic_char32_t*, char32_t); |
| 8703 | char32_t atomic_fetch_xor(atomic_char32_t*, char32_t); |
| 8704 | char32_t atomic_fetch_xor_explicit(volatile atomic_char32_t*, char32_t, |
| 8705 | memory_order); |
| 8706 | char32_t atomic_fetch_xor_explicit(atomic_char32_t*, char32_t, memory_order); |
| 8707 | |
| 8708 | typedef struct atomic_char32_t |
| 8709 | { |
| 8710 | char32_t __v_; |
| 8711 | |
| 8712 | _LIBCPP_INLINE_VISIBILITY |
| 8713 | bool is_lock_free() const volatile |
| 8714 | {return atomic_is_lock_free(this);} |
| 8715 | _LIBCPP_INLINE_VISIBILITY |
| 8716 | bool is_lock_free() const |
| 8717 | {return atomic_is_lock_free(this);} |
| 8718 | _LIBCPP_INLINE_VISIBILITY |
| 8719 | void store(char32_t __v, memory_order __o = memory_order_seq_cst) volatile |
| 8720 | {atomic_store_explicit(this, __v, __o);} |
| 8721 | _LIBCPP_INLINE_VISIBILITY |
| 8722 | void store(char32_t __v, memory_order __o = memory_order_seq_cst) |
| 8723 | {atomic_store_explicit(this, __v, __o);} |
| 8724 | _LIBCPP_INLINE_VISIBILITY |
| 8725 | char32_t load(memory_order __o = memory_order_seq_cst) const volatile |
| 8726 | {return atomic_load_explicit(this, __o);} |
| 8727 | _LIBCPP_INLINE_VISIBILITY |
| 8728 | char32_t load(memory_order __o = memory_order_seq_cst) const |
| 8729 | {return atomic_load_explicit(this, __o);} |
| 8730 | _LIBCPP_INLINE_VISIBILITY |
| 8731 | operator char32_t() const volatile |
| 8732 | {return load();} |
| 8733 | _LIBCPP_INLINE_VISIBILITY |
| 8734 | operator char32_t() const |
| 8735 | {return load();} |
| 8736 | _LIBCPP_INLINE_VISIBILITY |
| 8737 | char32_t exchange(char32_t __v, |
| 8738 | memory_order __o = memory_order_seq_cst) volatile |
| 8739 | {return atomic_exchange_explicit(this, __v, __o);} |
| 8740 | _LIBCPP_INLINE_VISIBILITY |
| 8741 | char32_t exchange(char32_t __v, memory_order __o = memory_order_seq_cst) |
| 8742 | {return atomic_exchange_explicit(this, __v, __o);} |
| 8743 | _LIBCPP_INLINE_VISIBILITY |
| 8744 | bool compare_exchange_weak(char32_t& __v, char32_t __e, memory_order __s, |
| 8745 | memory_order __f) volatile |
| 8746 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 8747 | __f);} |
| 8748 | _LIBCPP_INLINE_VISIBILITY |
| 8749 | bool compare_exchange_weak(char32_t& __v, char32_t __e, memory_order __s, |
| 8750 | memory_order __f) |
| 8751 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 8752 | __f);} |
| 8753 | _LIBCPP_INLINE_VISIBILITY |
| 8754 | bool compare_exchange_strong(char32_t& __v, char32_t __e, memory_order __s, |
| 8755 | memory_order __f) volatile |
| 8756 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 8757 | __f);} |
| 8758 | _LIBCPP_INLINE_VISIBILITY |
| 8759 | bool compare_exchange_strong(char32_t& __v, char32_t __e, memory_order __s, |
| 8760 | memory_order __f) |
| 8761 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 8762 | __f);} |
| 8763 | _LIBCPP_INLINE_VISIBILITY |
| 8764 | bool compare_exchange_weak(char32_t& __v, char32_t __e, |
| 8765 | memory_order __s = memory_order_seq_cst) volatile |
| 8766 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 8767 | __translate_memory_order(__s));} |
| 8768 | _LIBCPP_INLINE_VISIBILITY |
| 8769 | bool compare_exchange_weak(char32_t& __v, char32_t __e, |
| 8770 | memory_order __s = memory_order_seq_cst) |
| 8771 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 8772 | __translate_memory_order(__s));} |
| 8773 | _LIBCPP_INLINE_VISIBILITY |
| 8774 | bool compare_exchange_strong(char32_t& __v, char32_t __e, |
| 8775 | memory_order __s = memory_order_seq_cst) volatile |
| 8776 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 8777 | __translate_memory_order(__s));} |
| 8778 | _LIBCPP_INLINE_VISIBILITY |
| 8779 | bool compare_exchange_strong(char32_t& __v, char32_t __e, |
| 8780 | memory_order __s = memory_order_seq_cst) |
| 8781 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 8782 | __translate_memory_order(__s));} |
| 8783 | _LIBCPP_INLINE_VISIBILITY |
| 8784 | char32_t fetch_add(char32_t __v, |
| 8785 | memory_order __o = memory_order_seq_cst) volatile |
| 8786 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 8787 | _LIBCPP_INLINE_VISIBILITY |
| 8788 | char32_t fetch_add(char32_t __v, memory_order __o = memory_order_seq_cst) |
| 8789 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 8790 | _LIBCPP_INLINE_VISIBILITY |
| 8791 | char32_t fetch_sub(char32_t __v, |
| 8792 | memory_order __o = memory_order_seq_cst) volatile |
| 8793 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 8794 | _LIBCPP_INLINE_VISIBILITY |
| 8795 | char32_t fetch_sub(char32_t __v, memory_order __o = memory_order_seq_cst) |
| 8796 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 8797 | _LIBCPP_INLINE_VISIBILITY |
| 8798 | char32_t fetch_and(char32_t __v, |
| 8799 | memory_order __o = memory_order_seq_cst) volatile |
| 8800 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 8801 | _LIBCPP_INLINE_VISIBILITY |
| 8802 | char32_t fetch_and(char32_t __v, memory_order __o = memory_order_seq_cst) |
| 8803 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 8804 | _LIBCPP_INLINE_VISIBILITY |
| 8805 | char32_t fetch_or(char32_t __v, |
| 8806 | memory_order __o = memory_order_seq_cst) volatile |
| 8807 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 8808 | _LIBCPP_INLINE_VISIBILITY |
| 8809 | char32_t fetch_or(char32_t __v, memory_order __o = memory_order_seq_cst) |
| 8810 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 8811 | _LIBCPP_INLINE_VISIBILITY |
| 8812 | char32_t fetch_xor(char32_t __v, |
| 8813 | memory_order __o = memory_order_seq_cst) volatile |
| 8814 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 8815 | _LIBCPP_INLINE_VISIBILITY |
| 8816 | char32_t fetch_xor(char32_t __v, memory_order __o = memory_order_seq_cst) |
| 8817 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 8818 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 8819 | atomic_char32_t() = default; |
| 8820 | #else |
| 8821 | _LIBCPP_INLINE_VISIBILITY |
| 8822 | atomic_char32_t() {} |
| 8823 | #endif |
| 8824 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 8825 | constexpr atomic_char32_t(char32_t __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 8826 | : __v_(__v) {} |
| 8827 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 8828 | atomic_char32_t(const atomic_char32_t&) = delete; |
| 8829 | atomic_char32_t& operator=(const atomic_char32_t&) = delete; |
| 8830 | atomic_char32_t& operator=(const atomic_char32_t&) volatile = delete; |
| 8831 | #else |
| 8832 | private: |
| 8833 | atomic_char32_t(const atomic_char32_t&); |
| 8834 | atomic_char32_t& operator=(const atomic_char32_t&); |
| 8835 | atomic_char32_t& operator=(const atomic_char32_t&) volatile; |
| 8836 | public: |
| 8837 | #endif |
| 8838 | _LIBCPP_INLINE_VISIBILITY |
| 8839 | char32_t operator=(char32_t __v) volatile |
| 8840 | {store(__v); return __v;} |
| 8841 | _LIBCPP_INLINE_VISIBILITY |
| 8842 | char32_t operator=(char32_t __v) |
| 8843 | {store(__v); return __v;} |
| 8844 | _LIBCPP_INLINE_VISIBILITY |
| 8845 | char32_t operator++(int) volatile |
| 8846 | {return fetch_add(char32_t(1));} |
| 8847 | _LIBCPP_INLINE_VISIBILITY |
| 8848 | char32_t operator++(int) |
| 8849 | {return fetch_add(char32_t(1));} |
| 8850 | _LIBCPP_INLINE_VISIBILITY |
| 8851 | char32_t operator--(int) volatile |
| 8852 | {return fetch_sub(char32_t(1));} |
| 8853 | _LIBCPP_INLINE_VISIBILITY |
| 8854 | char32_t operator--(int) |
| 8855 | {return fetch_sub(char32_t(1));} |
| 8856 | _LIBCPP_INLINE_VISIBILITY |
| 8857 | char32_t operator++() volatile |
| 8858 | {return char32_t(fetch_add(char32_t(1)) + 1);} |
| 8859 | _LIBCPP_INLINE_VISIBILITY |
| 8860 | char32_t operator++() |
| 8861 | {return char32_t(fetch_add(char32_t(1)) + 1);} |
| 8862 | _LIBCPP_INLINE_VISIBILITY |
| 8863 | char32_t operator--() volatile |
| 8864 | {return char32_t(fetch_sub(char32_t(1)) - 1);} |
| 8865 | _LIBCPP_INLINE_VISIBILITY |
| 8866 | char32_t operator--() |
| 8867 | {return char32_t(fetch_sub(char32_t(1)) - 1);} |
| 8868 | _LIBCPP_INLINE_VISIBILITY |
| 8869 | char32_t operator+=(char32_t __v) volatile |
| 8870 | {return char32_t(fetch_add(__v) + __v);} |
| 8871 | _LIBCPP_INLINE_VISIBILITY |
| 8872 | char32_t operator+=(char32_t __v) |
| 8873 | {return char32_t(fetch_add(__v) + __v);} |
| 8874 | _LIBCPP_INLINE_VISIBILITY |
| 8875 | char32_t operator-=(char32_t __v) volatile |
| 8876 | {return char32_t(fetch_sub(__v) - __v);} |
| 8877 | _LIBCPP_INLINE_VISIBILITY |
| 8878 | char32_t operator-=(char32_t __v) |
| 8879 | {return char32_t(fetch_sub(__v) - __v);} |
| 8880 | _LIBCPP_INLINE_VISIBILITY |
| 8881 | char32_t operator&=(char32_t __v) volatile |
| 8882 | {return char32_t(fetch_and(__v) & __v);} |
| 8883 | _LIBCPP_INLINE_VISIBILITY |
| 8884 | char32_t operator&=(char32_t __v) |
| 8885 | {return char32_t(fetch_and(__v) & __v);} |
| 8886 | _LIBCPP_INLINE_VISIBILITY |
| 8887 | char32_t operator|=(char32_t __v) volatile |
| 8888 | {return char32_t(fetch_or(__v) | __v);} |
| 8889 | _LIBCPP_INLINE_VISIBILITY |
| 8890 | char32_t operator|=(char32_t __v) |
| 8891 | {return char32_t(fetch_or(__v) | __v);} |
| 8892 | _LIBCPP_INLINE_VISIBILITY |
| 8893 | char32_t operator^=(char32_t __v) volatile |
| 8894 | {return char32_t(fetch_xor(__v) ^ __v);} |
| 8895 | _LIBCPP_INLINE_VISIBILITY |
| 8896 | char32_t operator^=(char32_t __v) |
| 8897 | {return char32_t(fetch_xor(__v) ^ __v);} |
| 8898 | } atomic_char32_t; |
| 8899 | |
| 8900 | inline _LIBCPP_INLINE_VISIBILITY |
| 8901 | bool |
| 8902 | atomic_is_lock_free(const volatile atomic_char32_t*) |
| 8903 | { |
| 8904 | typedef char32_t type; |
| 8905 | return __atomic_is_lock_free(type); |
| 8906 | } |
| 8907 | |
| 8908 | inline _LIBCPP_INLINE_VISIBILITY |
| 8909 | bool |
| 8910 | atomic_is_lock_free(const atomic_char32_t* __obj) |
| 8911 | { |
| 8912 | return atomic_is_lock_free(const_cast<volatile atomic_char32_t*>(__obj)); |
| 8913 | } |
| 8914 | |
| 8915 | inline _LIBCPP_INLINE_VISIBILITY |
| 8916 | void |
| 8917 | atomic_init(volatile atomic_char32_t* __obj, char32_t __desr) |
| 8918 | { |
| 8919 | __obj->__v_ = __desr; |
| 8920 | } |
| 8921 | |
| 8922 | inline _LIBCPP_INLINE_VISIBILITY |
| 8923 | void |
| 8924 | atomic_init(atomic_char32_t* __obj, char32_t __desr) |
| 8925 | { |
| 8926 | __obj->__v_ = __desr; |
| 8927 | } |
| 8928 | |
| 8929 | inline _LIBCPP_INLINE_VISIBILITY |
| 8930 | void |
| 8931 | atomic_store(volatile atomic_char32_t* __obj, char32_t __desr) |
| 8932 | { |
| 8933 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 8934 | } |
| 8935 | |
| 8936 | inline _LIBCPP_INLINE_VISIBILITY |
| 8937 | void |
| 8938 | atomic_store(atomic_char32_t* __obj, char32_t __desr) |
| 8939 | { |
| 8940 | atomic_store(const_cast<volatile atomic_char32_t*>(__obj), __desr); |
| 8941 | } |
| 8942 | |
| 8943 | inline _LIBCPP_INLINE_VISIBILITY |
| 8944 | void |
| 8945 | atomic_store_explicit(volatile atomic_char32_t* __obj, char32_t __desr, |
| 8946 | memory_order __o) |
| 8947 | { |
| 8948 | __atomic_store(&__obj->__v_, __desr, __o); |
| 8949 | } |
| 8950 | |
| 8951 | inline _LIBCPP_INLINE_VISIBILITY |
| 8952 | void |
| 8953 | atomic_store_explicit(atomic_char32_t* __obj, char32_t __desr, memory_order __o) |
| 8954 | { |
| 8955 | atomic_store_explicit(const_cast<volatile atomic_char32_t*>(__obj), __desr, |
| 8956 | __o); |
| 8957 | } |
| 8958 | |
| 8959 | inline _LIBCPP_INLINE_VISIBILITY |
| 8960 | char32_t |
| 8961 | atomic_load(const volatile atomic_char32_t* __obj) |
| 8962 | { |
| 8963 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 8964 | } |
| 8965 | |
| 8966 | inline _LIBCPP_INLINE_VISIBILITY |
| 8967 | char32_t |
| 8968 | atomic_load(const atomic_char32_t* __obj) |
| 8969 | { |
| 8970 | return atomic_load(const_cast<const volatile atomic_char32_t*>(__obj)); |
| 8971 | } |
| 8972 | |
| 8973 | inline _LIBCPP_INLINE_VISIBILITY |
| 8974 | char32_t |
| 8975 | atomic_load_explicit(const volatile atomic_char32_t* __obj, memory_order __o) |
| 8976 | { |
| 8977 | return __atomic_load(&__obj->__v_, __o); |
| 8978 | } |
| 8979 | |
| 8980 | inline _LIBCPP_INLINE_VISIBILITY |
| 8981 | char32_t |
| 8982 | atomic_load_explicit(const atomic_char32_t* __obj, memory_order __o) |
| 8983 | { |
| 8984 | return atomic_load_explicit(const_cast<const volatile atomic_char32_t*> |
| 8985 | (__obj), __o); |
| 8986 | } |
| 8987 | |
| 8988 | inline _LIBCPP_INLINE_VISIBILITY |
| 8989 | char32_t |
| 8990 | atomic_exchange(volatile atomic_char32_t* __obj, char32_t __desr) |
| 8991 | { |
| 8992 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 8993 | } |
| 8994 | |
| 8995 | inline _LIBCPP_INLINE_VISIBILITY |
| 8996 | char32_t |
| 8997 | atomic_exchange(atomic_char32_t* __obj, char32_t __desr) |
| 8998 | { |
| 8999 | return atomic_exchange(const_cast<volatile atomic_char32_t*>(__obj), __desr); |
| 9000 | } |
| 9001 | |
| 9002 | inline _LIBCPP_INLINE_VISIBILITY |
| 9003 | char32_t |
| 9004 | atomic_exchange_explicit(volatile atomic_char32_t* __obj, char32_t __desr, |
| 9005 | memory_order __o) |
| 9006 | { |
| 9007 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 9008 | } |
| 9009 | |
| 9010 | inline _LIBCPP_INLINE_VISIBILITY |
| 9011 | char32_t |
| 9012 | atomic_exchange_explicit(atomic_char32_t* __obj, char32_t __desr, |
| 9013 | memory_order __o) |
| 9014 | { |
| 9015 | return atomic_exchange_explicit(const_cast<volatile atomic_char32_t*> |
| 9016 | (__obj), __desr, __o); |
| 9017 | } |
| 9018 | |
| 9019 | inline _LIBCPP_INLINE_VISIBILITY |
| 9020 | bool |
| 9021 | atomic_compare_exchange_weak(volatile atomic_char32_t* __obj, char32_t* __exp, |
| 9022 | char32_t __desr) |
| 9023 | { |
| 9024 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 9025 | memory_order_seq_cst, memory_order_seq_cst); |
| 9026 | } |
| 9027 | |
| 9028 | inline _LIBCPP_INLINE_VISIBILITY |
| 9029 | bool |
| 9030 | atomic_compare_exchange_weak(atomic_char32_t* __obj, char32_t* __exp, |
| 9031 | char32_t __desr) |
| 9032 | { |
| 9033 | return atomic_compare_exchange_weak(const_cast<volatile atomic_char32_t*> |
| 9034 | (__obj), __exp, __desr); |
| 9035 | } |
| 9036 | |
| 9037 | inline _LIBCPP_INLINE_VISIBILITY |
| 9038 | bool |
| 9039 | atomic_compare_exchange_strong(volatile atomic_char32_t* __obj, char32_t* __exp, |
| 9040 | char32_t __desr) |
| 9041 | { |
| 9042 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 9043 | memory_order_seq_cst, memory_order_seq_cst); |
| 9044 | } |
| 9045 | |
| 9046 | inline _LIBCPP_INLINE_VISIBILITY |
| 9047 | bool |
| 9048 | atomic_compare_exchange_strong(atomic_char32_t* __obj, char32_t* __exp, |
| 9049 | char32_t __desr) |
| 9050 | { |
| 9051 | return atomic_compare_exchange_strong(const_cast<volatile atomic_char32_t*> |
| 9052 | (__obj), __exp, __desr); |
| 9053 | } |
| 9054 | |
| 9055 | inline _LIBCPP_INLINE_VISIBILITY |
| 9056 | bool |
| 9057 | atomic_compare_exchange_weak_explicit(volatile atomic_char32_t* __obj, |
| 9058 | char32_t* __exp, char32_t __desr, |
| 9059 | memory_order __s, memory_order __f) |
| 9060 | { |
| 9061 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 9062 | __f); |
| 9063 | } |
| 9064 | |
| 9065 | inline _LIBCPP_INLINE_VISIBILITY |
| 9066 | bool |
| 9067 | atomic_compare_exchange_weak_explicit(atomic_char32_t* __obj, char32_t* __exp, |
| 9068 | char32_t __desr, memory_order __s, |
| 9069 | memory_order __f) |
| 9070 | { |
| 9071 | return atomic_compare_exchange_weak_explicit( |
| 9072 | const_cast<volatile atomic_char32_t*>(__obj), __exp, __desr, __s, __f); |
| 9073 | } |
| 9074 | |
| 9075 | inline _LIBCPP_INLINE_VISIBILITY |
| 9076 | bool |
| 9077 | atomic_compare_exchange_strong_explicit(volatile atomic_char32_t* __obj, |
| 9078 | char32_t* __exp, char32_t __desr, |
| 9079 | memory_order __s, memory_order __f) |
| 9080 | { |
| 9081 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 9082 | __f); |
| 9083 | } |
| 9084 | |
| 9085 | inline _LIBCPP_INLINE_VISIBILITY |
| 9086 | bool |
| 9087 | atomic_compare_exchange_strong_explicit(atomic_char32_t* __obj, char32_t* __exp, |
| 9088 | char32_t __desr, memory_order __s, |
| 9089 | memory_order __f) |
| 9090 | { |
| 9091 | return atomic_compare_exchange_strong_explicit( |
| 9092 | const_cast<volatile atomic_char32_t*>(__obj), __exp, __desr, __s, __f); |
| 9093 | } |
| 9094 | |
| 9095 | inline _LIBCPP_INLINE_VISIBILITY |
| 9096 | char32_t |
| 9097 | atomic_fetch_add(volatile atomic_char32_t* __obj, char32_t __v) |
| 9098 | { |
| 9099 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 9100 | } |
| 9101 | |
| 9102 | inline _LIBCPP_INLINE_VISIBILITY |
| 9103 | char32_t |
| 9104 | atomic_fetch_add(atomic_char32_t* __obj, char32_t __v) |
| 9105 | { |
| 9106 | return atomic_fetch_add(const_cast<volatile atomic_char32_t*>(__obj), __v); |
| 9107 | } |
| 9108 | |
| 9109 | inline _LIBCPP_INLINE_VISIBILITY |
| 9110 | char32_t |
| 9111 | atomic_fetch_add_explicit(volatile atomic_char32_t* __obj, char32_t __v, |
| 9112 | memory_order __o) |
| 9113 | { |
| 9114 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 9115 | } |
| 9116 | |
| 9117 | inline _LIBCPP_INLINE_VISIBILITY |
| 9118 | char32_t |
| 9119 | atomic_fetch_add_explicit(atomic_char32_t* __obj, char32_t __v, |
| 9120 | memory_order __o) |
| 9121 | { |
| 9122 | return atomic_fetch_add_explicit(const_cast<volatile atomic_char32_t*>(__obj), |
| 9123 | __v, __o); |
| 9124 | } |
| 9125 | |
| 9126 | inline _LIBCPP_INLINE_VISIBILITY |
| 9127 | char32_t |
| 9128 | atomic_fetch_sub(volatile atomic_char32_t* __obj, char32_t __v) |
| 9129 | { |
| 9130 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 9131 | } |
| 9132 | |
| 9133 | inline _LIBCPP_INLINE_VISIBILITY |
| 9134 | char32_t |
| 9135 | atomic_fetch_sub(atomic_char32_t* __obj, char32_t __v) |
| 9136 | { |
| 9137 | return atomic_fetch_sub(const_cast<volatile atomic_char32_t*>(__obj), __v); |
| 9138 | } |
| 9139 | |
| 9140 | inline _LIBCPP_INLINE_VISIBILITY |
| 9141 | char32_t |
| 9142 | atomic_fetch_sub_explicit(volatile atomic_char32_t* __obj, char32_t __v, |
| 9143 | memory_order __o) |
| 9144 | { |
| 9145 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 9146 | } |
| 9147 | |
| 9148 | inline _LIBCPP_INLINE_VISIBILITY |
| 9149 | char32_t |
| 9150 | atomic_fetch_sub_explicit(atomic_char32_t* __obj, char32_t __v, |
| 9151 | memory_order __o) |
| 9152 | { |
| 9153 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_char32_t*>(__obj), |
| 9154 | __v, __o); |
| 9155 | } |
| 9156 | |
| 9157 | inline _LIBCPP_INLINE_VISIBILITY |
| 9158 | char32_t |
| 9159 | atomic_fetch_and(volatile atomic_char32_t* __obj, char32_t __v) |
| 9160 | { |
| 9161 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 9162 | } |
| 9163 | |
| 9164 | inline _LIBCPP_INLINE_VISIBILITY |
| 9165 | char32_t |
| 9166 | atomic_fetch_and(atomic_char32_t* __obj, char32_t __v) |
| 9167 | { |
| 9168 | return atomic_fetch_and(const_cast<volatile atomic_char32_t*>(__obj), __v); |
| 9169 | } |
| 9170 | |
| 9171 | inline _LIBCPP_INLINE_VISIBILITY |
| 9172 | char32_t |
| 9173 | atomic_fetch_and_explicit(volatile atomic_char32_t* __obj, char32_t __v, |
| 9174 | memory_order __o) |
| 9175 | { |
| 9176 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 9177 | } |
| 9178 | |
| 9179 | inline _LIBCPP_INLINE_VISIBILITY |
| 9180 | char32_t |
| 9181 | atomic_fetch_and_explicit(atomic_char32_t* __obj, char32_t __v, |
| 9182 | memory_order __o) |
| 9183 | { |
| 9184 | return atomic_fetch_and_explicit(const_cast<volatile atomic_char32_t*>(__obj), |
| 9185 | __v, __o); |
| 9186 | } |
| 9187 | |
| 9188 | inline _LIBCPP_INLINE_VISIBILITY |
| 9189 | char32_t |
| 9190 | atomic_fetch_or(volatile atomic_char32_t* __obj, char32_t __v) |
| 9191 | { |
| 9192 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 9193 | } |
| 9194 | |
| 9195 | inline _LIBCPP_INLINE_VISIBILITY |
| 9196 | char32_t |
| 9197 | atomic_fetch_or(atomic_char32_t* __obj, char32_t __v) |
| 9198 | { |
| 9199 | return atomic_fetch_or(const_cast<volatile atomic_char32_t*>(__obj), __v); |
| 9200 | } |
| 9201 | |
| 9202 | inline _LIBCPP_INLINE_VISIBILITY |
| 9203 | char32_t |
| 9204 | atomic_fetch_or_explicit(volatile atomic_char32_t* __obj, char32_t __v, |
| 9205 | memory_order __o) |
| 9206 | { |
| 9207 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 9208 | } |
| 9209 | |
| 9210 | inline _LIBCPP_INLINE_VISIBILITY |
| 9211 | char32_t |
| 9212 | atomic_fetch_or_explicit(atomic_char32_t* __obj, char32_t __v, memory_order __o) |
| 9213 | { |
| 9214 | return atomic_fetch_or_explicit(const_cast<volatile atomic_char32_t*>(__obj), |
| 9215 | __v, __o); |
| 9216 | } |
| 9217 | |
| 9218 | inline _LIBCPP_INLINE_VISIBILITY |
| 9219 | char32_t |
| 9220 | atomic_fetch_xor(volatile atomic_char32_t* __obj, char32_t __v) |
| 9221 | { |
| 9222 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 9223 | } |
| 9224 | |
| 9225 | inline _LIBCPP_INLINE_VISIBILITY |
| 9226 | char32_t |
| 9227 | atomic_fetch_xor(atomic_char32_t* __obj, char32_t __v) |
| 9228 | { |
| 9229 | return atomic_fetch_xor(const_cast<volatile atomic_char32_t*>(__obj), __v); |
| 9230 | } |
| 9231 | |
| 9232 | inline _LIBCPP_INLINE_VISIBILITY |
| 9233 | char32_t |
| 9234 | atomic_fetch_xor_explicit(volatile atomic_char32_t* __obj, char32_t __v, |
| 9235 | memory_order __o) |
| 9236 | { |
| 9237 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 9238 | } |
| 9239 | |
| 9240 | inline _LIBCPP_INLINE_VISIBILITY |
| 9241 | char32_t |
| 9242 | atomic_fetch_xor_explicit(atomic_char32_t* __obj, char32_t __v, |
| 9243 | memory_order __o) |
| 9244 | { |
| 9245 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_char32_t*>(__obj), |
| 9246 | __v, __o); |
| 9247 | } |
| 9248 | |
| 9249 | #endif // _LIBCPP_HAS_NO_UNICODE_CHARS |
| 9250 | |
| 9251 | // atomic_wchar_t |
| 9252 | |
| 9253 | struct atomic_wchar_t; |
| 9254 | |
| 9255 | bool atomic_is_lock_free(const volatile atomic_wchar_t*); |
| 9256 | bool atomic_is_lock_free(const atomic_wchar_t*); |
| 9257 | void atomic_init(volatile atomic_wchar_t*, wchar_t); |
| 9258 | void atomic_init(atomic_wchar_t*, wchar_t); |
| 9259 | void atomic_store(volatile atomic_wchar_t*, wchar_t); |
| 9260 | void atomic_store(atomic_wchar_t*, wchar_t); |
| 9261 | void atomic_store_explicit(volatile atomic_wchar_t*, wchar_t, memory_order); |
| 9262 | void atomic_store_explicit(atomic_wchar_t*, wchar_t, memory_order); |
| 9263 | wchar_t atomic_load(const volatile atomic_wchar_t*); |
| 9264 | wchar_t atomic_load(const atomic_wchar_t*); |
| 9265 | wchar_t atomic_load_explicit(const volatile atomic_wchar_t*, memory_order); |
| 9266 | wchar_t atomic_load_explicit(const atomic_wchar_t*, memory_order); |
| 9267 | wchar_t atomic_exchange(volatile atomic_wchar_t*, wchar_t); |
| 9268 | wchar_t atomic_exchange(atomic_wchar_t*, wchar_t); |
| 9269 | wchar_t atomic_exchange_explicit(volatile atomic_wchar_t*, wchar_t, |
| 9270 | memory_order); |
| 9271 | wchar_t atomic_exchange_explicit(atomic_wchar_t*, wchar_t, memory_order); |
| 9272 | bool atomic_compare_exchange_weak(volatile atomic_wchar_t*, wchar_t*, |
| 9273 | wchar_t); |
| 9274 | bool atomic_compare_exchange_weak(atomic_wchar_t*, wchar_t*, wchar_t); |
| 9275 | bool atomic_compare_exchange_strong(volatile atomic_wchar_t*, wchar_t*, |
| 9276 | wchar_t); |
| 9277 | bool atomic_compare_exchange_strong(atomic_wchar_t*, wchar_t*, wchar_t); |
| 9278 | bool atomic_compare_exchange_weak_explicit(volatile atomic_wchar_t*, wchar_t*, |
| 9279 | wchar_t, memory_order, |
| 9280 | memory_order); |
| 9281 | bool atomic_compare_exchange_weak_explicit(atomic_wchar_t*, wchar_t*, |
| 9282 | wchar_t, memory_order, |
| 9283 | memory_order); |
| 9284 | bool atomic_compare_exchange_strong_explicit(volatile atomic_wchar_t*, |
| 9285 | wchar_t*, wchar_t, memory_order, |
| 9286 | memory_order); |
| 9287 | bool atomic_compare_exchange_strong_explicit(atomic_wchar_t*, wchar_t*, |
| 9288 | wchar_t, memory_order, |
| 9289 | memory_order); |
| 9290 | wchar_t atomic_fetch_add(volatile atomic_wchar_t*, wchar_t); |
| 9291 | wchar_t atomic_fetch_add(atomic_wchar_t*, wchar_t); |
| 9292 | wchar_t atomic_fetch_add_explicit(volatile atomic_wchar_t*, wchar_t, |
| 9293 | memory_order); |
| 9294 | wchar_t atomic_fetch_add_explicit(atomic_wchar_t*, wchar_t, memory_order); |
| 9295 | wchar_t atomic_fetch_sub(volatile atomic_wchar_t*, wchar_t); |
| 9296 | wchar_t atomic_fetch_sub(atomic_wchar_t*, wchar_t); |
| 9297 | wchar_t atomic_fetch_sub_explicit(volatile atomic_wchar_t*, wchar_t, |
| 9298 | memory_order); |
| 9299 | wchar_t atomic_fetch_sub_explicit(atomic_wchar_t*, wchar_t, memory_order); |
| 9300 | wchar_t atomic_fetch_and(volatile atomic_wchar_t*, wchar_t); |
| 9301 | wchar_t atomic_fetch_and(atomic_wchar_t*, wchar_t); |
| 9302 | wchar_t atomic_fetch_and_explicit(volatile atomic_wchar_t*, wchar_t, |
| 9303 | memory_order); |
| 9304 | wchar_t atomic_fetch_and_explicit(atomic_wchar_t*, wchar_t, memory_order); |
| 9305 | wchar_t atomic_fetch_or(volatile atomic_wchar_t*, wchar_t); |
| 9306 | wchar_t atomic_fetch_or(atomic_wchar_t*, wchar_t); |
| 9307 | wchar_t atomic_fetch_or_explicit(volatile atomic_wchar_t*, wchar_t, |
| 9308 | memory_order); |
| 9309 | wchar_t atomic_fetch_or_explicit(atomic_wchar_t*, wchar_t, memory_order); |
| 9310 | wchar_t atomic_fetch_xor(volatile atomic_wchar_t*, wchar_t); |
| 9311 | wchar_t atomic_fetch_xor(atomic_wchar_t*, wchar_t); |
| 9312 | wchar_t atomic_fetch_xor_explicit(volatile atomic_wchar_t*, wchar_t, |
| 9313 | memory_order); |
| 9314 | wchar_t atomic_fetch_xor_explicit(atomic_wchar_t*, wchar_t, memory_order); |
| 9315 | |
| 9316 | typedef struct atomic_wchar_t |
| 9317 | { |
| 9318 | wchar_t __v_; |
| 9319 | |
| 9320 | _LIBCPP_INLINE_VISIBILITY |
| 9321 | bool is_lock_free() const volatile |
| 9322 | {return atomic_is_lock_free(this);} |
| 9323 | _LIBCPP_INLINE_VISIBILITY |
| 9324 | bool is_lock_free() const |
| 9325 | {return atomic_is_lock_free(this);} |
| 9326 | _LIBCPP_INLINE_VISIBILITY |
| 9327 | void store(wchar_t __v, memory_order __o = memory_order_seq_cst) volatile |
| 9328 | {atomic_store_explicit(this, __v, __o);} |
| 9329 | _LIBCPP_INLINE_VISIBILITY |
| 9330 | void store(wchar_t __v, memory_order __o = memory_order_seq_cst) |
| 9331 | {atomic_store_explicit(this, __v, __o);} |
| 9332 | _LIBCPP_INLINE_VISIBILITY |
| 9333 | wchar_t load(memory_order __o = memory_order_seq_cst) const volatile |
| 9334 | {return atomic_load_explicit(this, __o);} |
| 9335 | _LIBCPP_INLINE_VISIBILITY |
| 9336 | wchar_t load(memory_order __o = memory_order_seq_cst) const |
| 9337 | {return atomic_load_explicit(this, __o);} |
| 9338 | _LIBCPP_INLINE_VISIBILITY |
| 9339 | operator wchar_t() const volatile |
| 9340 | {return load();} |
| 9341 | _LIBCPP_INLINE_VISIBILITY |
| 9342 | operator wchar_t() const |
| 9343 | {return load();} |
| 9344 | _LIBCPP_INLINE_VISIBILITY |
| 9345 | wchar_t exchange(wchar_t __v, |
| 9346 | memory_order __o = memory_order_seq_cst) volatile |
| 9347 | {return atomic_exchange_explicit(this, __v, __o);} |
| 9348 | _LIBCPP_INLINE_VISIBILITY |
| 9349 | wchar_t exchange(wchar_t __v, memory_order __o = memory_order_seq_cst) |
| 9350 | {return atomic_exchange_explicit(this, __v, __o);} |
| 9351 | _LIBCPP_INLINE_VISIBILITY |
| 9352 | bool compare_exchange_weak(wchar_t& __v, wchar_t __e, memory_order __s, |
| 9353 | memory_order __f) volatile |
| 9354 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 9355 | __f);} |
| 9356 | _LIBCPP_INLINE_VISIBILITY |
| 9357 | bool compare_exchange_weak(wchar_t& __v, wchar_t __e, memory_order __s, |
| 9358 | memory_order __f) |
| 9359 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 9360 | __f);} |
| 9361 | _LIBCPP_INLINE_VISIBILITY |
| 9362 | bool compare_exchange_strong(wchar_t& __v, wchar_t __e, memory_order __s, |
| 9363 | memory_order __f) volatile |
| 9364 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 9365 | __f);} |
| 9366 | _LIBCPP_INLINE_VISIBILITY |
| 9367 | bool compare_exchange_strong(wchar_t& __v, wchar_t __e, memory_order __s, |
| 9368 | memory_order __f) |
| 9369 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 9370 | __f);} |
| 9371 | _LIBCPP_INLINE_VISIBILITY |
| 9372 | bool compare_exchange_weak(wchar_t& __v, wchar_t __e, |
| 9373 | memory_order __s = memory_order_seq_cst) volatile |
| 9374 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 9375 | __translate_memory_order(__s));} |
| 9376 | _LIBCPP_INLINE_VISIBILITY |
| 9377 | bool compare_exchange_weak(wchar_t& __v, wchar_t __e, |
| 9378 | memory_order __s = memory_order_seq_cst) |
| 9379 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 9380 | __translate_memory_order(__s));} |
| 9381 | _LIBCPP_INLINE_VISIBILITY |
| 9382 | bool compare_exchange_strong(wchar_t& __v, wchar_t __e, |
| 9383 | memory_order __s = memory_order_seq_cst) volatile |
| 9384 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 9385 | __translate_memory_order(__s));} |
| 9386 | _LIBCPP_INLINE_VISIBILITY |
| 9387 | bool compare_exchange_strong(wchar_t& __v, wchar_t __e, |
| 9388 | memory_order __s = memory_order_seq_cst) |
| 9389 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 9390 | __translate_memory_order(__s));} |
| 9391 | _LIBCPP_INLINE_VISIBILITY |
| 9392 | wchar_t fetch_add(wchar_t __v, |
| 9393 | memory_order __o = memory_order_seq_cst) volatile |
| 9394 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 9395 | _LIBCPP_INLINE_VISIBILITY |
| 9396 | wchar_t fetch_add(wchar_t __v, memory_order __o = memory_order_seq_cst) |
| 9397 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 9398 | _LIBCPP_INLINE_VISIBILITY |
| 9399 | wchar_t fetch_sub(wchar_t __v, |
| 9400 | memory_order __o = memory_order_seq_cst) volatile |
| 9401 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 9402 | _LIBCPP_INLINE_VISIBILITY |
| 9403 | wchar_t fetch_sub(wchar_t __v, memory_order __o = memory_order_seq_cst) |
| 9404 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 9405 | _LIBCPP_INLINE_VISIBILITY |
| 9406 | wchar_t fetch_and(wchar_t __v, |
| 9407 | memory_order __o = memory_order_seq_cst) volatile |
| 9408 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 9409 | _LIBCPP_INLINE_VISIBILITY |
| 9410 | wchar_t fetch_and(wchar_t __v, memory_order __o = memory_order_seq_cst) |
| 9411 | {return atomic_fetch_and_explicit(this, __v, __o);} |
| 9412 | _LIBCPP_INLINE_VISIBILITY |
| 9413 | wchar_t fetch_or(wchar_t __v, |
| 9414 | memory_order __o = memory_order_seq_cst) volatile |
| 9415 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 9416 | _LIBCPP_INLINE_VISIBILITY |
| 9417 | wchar_t fetch_or(wchar_t __v, memory_order __o = memory_order_seq_cst) |
| 9418 | {return atomic_fetch_or_explicit(this, __v, __o);} |
| 9419 | _LIBCPP_INLINE_VISIBILITY |
| 9420 | wchar_t fetch_xor(wchar_t __v, |
| 9421 | memory_order __o = memory_order_seq_cst) volatile |
| 9422 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 9423 | _LIBCPP_INLINE_VISIBILITY |
| 9424 | wchar_t fetch_xor(wchar_t __v, memory_order __o = memory_order_seq_cst) |
| 9425 | {return atomic_fetch_xor_explicit(this, __v, __o);} |
| 9426 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 9427 | atomic_wchar_t() = default; |
| 9428 | #else |
| 9429 | _LIBCPP_INLINE_VISIBILITY |
| 9430 | atomic_wchar_t() {} |
| 9431 | #endif |
| 9432 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 9433 | constexpr atomic_wchar_t(wchar_t __v) |
Howard Hinnant | 5bbe97d | 2010-10-19 21:22:10 +0000 | [diff] [blame] | 9434 | : __v_(__v) {} |
| 9435 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 9436 | atomic_wchar_t(const atomic_wchar_t&) = delete; |
| 9437 | atomic_wchar_t& operator=(const atomic_wchar_t&) = delete; |
| 9438 | atomic_wchar_t& operator=(const atomic_wchar_t&) volatile = delete; |
| 9439 | #else |
| 9440 | private: |
| 9441 | atomic_wchar_t(const atomic_wchar_t&); |
| 9442 | atomic_wchar_t& operator=(const atomic_wchar_t&); |
| 9443 | atomic_wchar_t& operator=(const atomic_wchar_t&) volatile; |
| 9444 | public: |
| 9445 | #endif |
| 9446 | _LIBCPP_INLINE_VISIBILITY |
| 9447 | wchar_t operator=(wchar_t __v) volatile |
| 9448 | {store(__v); return __v;} |
| 9449 | _LIBCPP_INLINE_VISIBILITY |
| 9450 | wchar_t operator=(wchar_t __v) |
| 9451 | {store(__v); return __v;} |
| 9452 | _LIBCPP_INLINE_VISIBILITY |
| 9453 | wchar_t operator++(int) volatile |
| 9454 | {return fetch_add(wchar_t(1));} |
| 9455 | _LIBCPP_INLINE_VISIBILITY |
| 9456 | wchar_t operator++(int) |
| 9457 | {return fetch_add(wchar_t(1));} |
| 9458 | _LIBCPP_INLINE_VISIBILITY |
| 9459 | wchar_t operator--(int) volatile |
| 9460 | {return fetch_sub(wchar_t(1));} |
| 9461 | _LIBCPP_INLINE_VISIBILITY |
| 9462 | wchar_t operator--(int) |
| 9463 | {return fetch_sub(wchar_t(1));} |
| 9464 | _LIBCPP_INLINE_VISIBILITY |
| 9465 | wchar_t operator++() volatile |
| 9466 | {return wchar_t(fetch_add(wchar_t(1)) + 1);} |
| 9467 | _LIBCPP_INLINE_VISIBILITY |
| 9468 | wchar_t operator++() |
| 9469 | {return wchar_t(fetch_add(wchar_t(1)) + 1);} |
| 9470 | _LIBCPP_INLINE_VISIBILITY |
| 9471 | wchar_t operator--() volatile |
| 9472 | {return wchar_t(fetch_sub(wchar_t(1)) - 1);} |
| 9473 | _LIBCPP_INLINE_VISIBILITY |
| 9474 | wchar_t operator--() |
| 9475 | {return wchar_t(fetch_sub(wchar_t(1)) - 1);} |
| 9476 | _LIBCPP_INLINE_VISIBILITY |
| 9477 | wchar_t operator+=(wchar_t __v) volatile |
| 9478 | {return wchar_t(fetch_add(__v) + __v);} |
| 9479 | _LIBCPP_INLINE_VISIBILITY |
| 9480 | wchar_t operator+=(wchar_t __v) |
| 9481 | {return wchar_t(fetch_add(__v) + __v);} |
| 9482 | _LIBCPP_INLINE_VISIBILITY |
| 9483 | wchar_t operator-=(wchar_t __v) volatile |
| 9484 | {return wchar_t(fetch_sub(__v) - __v);} |
| 9485 | _LIBCPP_INLINE_VISIBILITY |
| 9486 | wchar_t operator-=(wchar_t __v) |
| 9487 | {return wchar_t(fetch_sub(__v) - __v);} |
| 9488 | _LIBCPP_INLINE_VISIBILITY |
| 9489 | wchar_t operator&=(wchar_t __v) volatile |
| 9490 | {return wchar_t(fetch_and(__v) & __v);} |
| 9491 | _LIBCPP_INLINE_VISIBILITY |
| 9492 | wchar_t operator&=(wchar_t __v) |
| 9493 | {return wchar_t(fetch_and(__v) & __v);} |
| 9494 | _LIBCPP_INLINE_VISIBILITY |
| 9495 | wchar_t operator|=(wchar_t __v) volatile |
| 9496 | {return wchar_t(fetch_or(__v) | __v);} |
| 9497 | _LIBCPP_INLINE_VISIBILITY |
| 9498 | wchar_t operator|=(wchar_t __v) |
| 9499 | {return wchar_t(fetch_or(__v) | __v);} |
| 9500 | _LIBCPP_INLINE_VISIBILITY |
| 9501 | wchar_t operator^=(wchar_t __v) volatile |
| 9502 | {return wchar_t(fetch_xor(__v) ^ __v);} |
| 9503 | _LIBCPP_INLINE_VISIBILITY |
| 9504 | wchar_t operator^=(wchar_t __v) |
| 9505 | {return wchar_t(fetch_xor(__v) ^ __v);} |
| 9506 | } atomic_wchar_t; |
| 9507 | |
| 9508 | inline _LIBCPP_INLINE_VISIBILITY |
| 9509 | bool |
| 9510 | atomic_is_lock_free(const volatile atomic_wchar_t*) |
| 9511 | { |
| 9512 | typedef wchar_t type; |
| 9513 | return __atomic_is_lock_free(type); |
| 9514 | } |
| 9515 | |
| 9516 | inline _LIBCPP_INLINE_VISIBILITY |
| 9517 | bool |
| 9518 | atomic_is_lock_free(const atomic_wchar_t* __obj) |
| 9519 | { |
| 9520 | return atomic_is_lock_free(const_cast<volatile atomic_wchar_t*>(__obj)); |
| 9521 | } |
| 9522 | |
| 9523 | inline _LIBCPP_INLINE_VISIBILITY |
| 9524 | void |
| 9525 | atomic_init(volatile atomic_wchar_t* __obj, wchar_t __desr) |
| 9526 | { |
| 9527 | __obj->__v_ = __desr; |
| 9528 | } |
| 9529 | |
| 9530 | inline _LIBCPP_INLINE_VISIBILITY |
| 9531 | void |
| 9532 | atomic_init(atomic_wchar_t* __obj, wchar_t __desr) |
| 9533 | { |
| 9534 | __obj->__v_ = __desr; |
| 9535 | } |
| 9536 | |
| 9537 | inline _LIBCPP_INLINE_VISIBILITY |
| 9538 | void |
| 9539 | atomic_store(volatile atomic_wchar_t* __obj, wchar_t __desr) |
| 9540 | { |
| 9541 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 9542 | } |
| 9543 | |
| 9544 | inline _LIBCPP_INLINE_VISIBILITY |
| 9545 | void |
| 9546 | atomic_store(atomic_wchar_t* __obj, wchar_t __desr) |
| 9547 | { |
| 9548 | atomic_store(const_cast<volatile atomic_wchar_t*>(__obj), __desr); |
| 9549 | } |
| 9550 | |
| 9551 | inline _LIBCPP_INLINE_VISIBILITY |
| 9552 | void |
| 9553 | atomic_store_explicit(volatile atomic_wchar_t* __obj, wchar_t __desr, |
| 9554 | memory_order __o) |
| 9555 | { |
| 9556 | __atomic_store(&__obj->__v_, __desr, __o); |
| 9557 | } |
| 9558 | |
| 9559 | inline _LIBCPP_INLINE_VISIBILITY |
| 9560 | void |
| 9561 | atomic_store_explicit(atomic_wchar_t* __obj, wchar_t __desr, memory_order __o) |
| 9562 | { |
| 9563 | atomic_store_explicit(const_cast<volatile atomic_wchar_t*>(__obj), __desr, |
| 9564 | __o); |
| 9565 | } |
| 9566 | |
| 9567 | inline _LIBCPP_INLINE_VISIBILITY |
| 9568 | wchar_t |
| 9569 | atomic_load(const volatile atomic_wchar_t* __obj) |
| 9570 | { |
| 9571 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 9572 | } |
| 9573 | |
| 9574 | inline _LIBCPP_INLINE_VISIBILITY |
| 9575 | wchar_t |
| 9576 | atomic_load(const atomic_wchar_t* __obj) |
| 9577 | { |
| 9578 | return atomic_load(const_cast<const volatile atomic_wchar_t*>(__obj)); |
| 9579 | } |
| 9580 | |
| 9581 | inline _LIBCPP_INLINE_VISIBILITY |
| 9582 | wchar_t |
| 9583 | atomic_load_explicit(const volatile atomic_wchar_t* __obj, memory_order __o) |
| 9584 | { |
| 9585 | return __atomic_load(&__obj->__v_, __o); |
| 9586 | } |
| 9587 | |
| 9588 | inline _LIBCPP_INLINE_VISIBILITY |
| 9589 | wchar_t |
| 9590 | atomic_load_explicit(const atomic_wchar_t* __obj, memory_order __o) |
| 9591 | { |
| 9592 | return atomic_load_explicit(const_cast<const volatile atomic_wchar_t*> |
| 9593 | (__obj), __o); |
| 9594 | } |
| 9595 | |
| 9596 | inline _LIBCPP_INLINE_VISIBILITY |
| 9597 | wchar_t |
| 9598 | atomic_exchange(volatile atomic_wchar_t* __obj, wchar_t __desr) |
| 9599 | { |
| 9600 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 9601 | } |
| 9602 | |
| 9603 | inline _LIBCPP_INLINE_VISIBILITY |
| 9604 | wchar_t |
| 9605 | atomic_exchange(atomic_wchar_t* __obj, wchar_t __desr) |
| 9606 | { |
| 9607 | return atomic_exchange(const_cast<volatile atomic_wchar_t*>(__obj), __desr); |
| 9608 | } |
| 9609 | |
| 9610 | inline _LIBCPP_INLINE_VISIBILITY |
| 9611 | wchar_t |
| 9612 | atomic_exchange_explicit(volatile atomic_wchar_t* __obj, wchar_t __desr, |
| 9613 | memory_order __o) |
| 9614 | { |
| 9615 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 9616 | } |
| 9617 | |
| 9618 | inline _LIBCPP_INLINE_VISIBILITY |
| 9619 | wchar_t |
| 9620 | atomic_exchange_explicit(atomic_wchar_t* __obj, wchar_t __desr, |
| 9621 | memory_order __o) |
| 9622 | { |
| 9623 | return atomic_exchange_explicit(const_cast<volatile atomic_wchar_t*> |
| 9624 | (__obj), __desr, __o); |
| 9625 | } |
| 9626 | |
| 9627 | inline _LIBCPP_INLINE_VISIBILITY |
| 9628 | bool |
| 9629 | atomic_compare_exchange_weak(volatile atomic_wchar_t* __obj, wchar_t* __exp, |
| 9630 | wchar_t __desr) |
| 9631 | { |
| 9632 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 9633 | memory_order_seq_cst, memory_order_seq_cst); |
| 9634 | } |
| 9635 | |
| 9636 | inline _LIBCPP_INLINE_VISIBILITY |
| 9637 | bool |
| 9638 | atomic_compare_exchange_weak(atomic_wchar_t* __obj, wchar_t* __exp, |
| 9639 | wchar_t __desr) |
| 9640 | { |
| 9641 | return atomic_compare_exchange_weak(const_cast<volatile atomic_wchar_t*> |
| 9642 | (__obj), __exp, __desr); |
| 9643 | } |
| 9644 | |
| 9645 | inline _LIBCPP_INLINE_VISIBILITY |
| 9646 | bool |
| 9647 | atomic_compare_exchange_strong(volatile atomic_wchar_t* __obj, wchar_t* __exp, |
| 9648 | wchar_t __desr) |
| 9649 | { |
| 9650 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 9651 | memory_order_seq_cst, memory_order_seq_cst); |
| 9652 | } |
| 9653 | |
| 9654 | inline _LIBCPP_INLINE_VISIBILITY |
| 9655 | bool |
| 9656 | atomic_compare_exchange_strong(atomic_wchar_t* __obj, wchar_t* __exp, |
| 9657 | wchar_t __desr) |
| 9658 | { |
| 9659 | return atomic_compare_exchange_strong(const_cast<volatile atomic_wchar_t*> |
| 9660 | (__obj), __exp, __desr); |
| 9661 | } |
| 9662 | |
| 9663 | inline _LIBCPP_INLINE_VISIBILITY |
| 9664 | bool |
| 9665 | atomic_compare_exchange_weak_explicit(volatile atomic_wchar_t* __obj, |
| 9666 | wchar_t* __exp, wchar_t __desr, |
| 9667 | memory_order __s, memory_order __f) |
| 9668 | { |
| 9669 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 9670 | __f); |
| 9671 | } |
| 9672 | |
| 9673 | inline _LIBCPP_INLINE_VISIBILITY |
| 9674 | bool |
| 9675 | atomic_compare_exchange_weak_explicit(atomic_wchar_t* __obj, wchar_t* __exp, |
| 9676 | wchar_t __desr, memory_order __s, |
| 9677 | memory_order __f) |
| 9678 | { |
| 9679 | return atomic_compare_exchange_weak_explicit( |
| 9680 | const_cast<volatile atomic_wchar_t*>(__obj), __exp, __desr, __s, __f); |
| 9681 | } |
| 9682 | |
| 9683 | inline _LIBCPP_INLINE_VISIBILITY |
| 9684 | bool |
| 9685 | atomic_compare_exchange_strong_explicit(volatile atomic_wchar_t* __obj, |
| 9686 | wchar_t* __exp, wchar_t __desr, |
| 9687 | memory_order __s, memory_order __f) |
| 9688 | { |
| 9689 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 9690 | __f); |
| 9691 | } |
| 9692 | |
| 9693 | inline _LIBCPP_INLINE_VISIBILITY |
| 9694 | bool |
| 9695 | atomic_compare_exchange_strong_explicit(atomic_wchar_t* __obj, wchar_t* __exp, |
| 9696 | wchar_t __desr, memory_order __s, |
| 9697 | memory_order __f) |
| 9698 | { |
| 9699 | return atomic_compare_exchange_strong_explicit( |
| 9700 | const_cast<volatile atomic_wchar_t*>(__obj), __exp, __desr, __s, __f); |
| 9701 | } |
| 9702 | |
| 9703 | inline _LIBCPP_INLINE_VISIBILITY |
| 9704 | wchar_t |
| 9705 | atomic_fetch_add(volatile atomic_wchar_t* __obj, wchar_t __v) |
| 9706 | { |
| 9707 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 9708 | } |
| 9709 | |
| 9710 | inline _LIBCPP_INLINE_VISIBILITY |
| 9711 | wchar_t |
| 9712 | atomic_fetch_add(atomic_wchar_t* __obj, wchar_t __v) |
| 9713 | { |
| 9714 | return atomic_fetch_add(const_cast<volatile atomic_wchar_t*>(__obj), __v); |
| 9715 | } |
| 9716 | |
| 9717 | inline _LIBCPP_INLINE_VISIBILITY |
| 9718 | wchar_t |
| 9719 | atomic_fetch_add_explicit(volatile atomic_wchar_t* __obj, wchar_t __v, |
| 9720 | memory_order __o) |
| 9721 | { |
| 9722 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 9723 | } |
| 9724 | |
| 9725 | inline _LIBCPP_INLINE_VISIBILITY |
| 9726 | wchar_t |
| 9727 | atomic_fetch_add_explicit(atomic_wchar_t* __obj, wchar_t __v, |
| 9728 | memory_order __o) |
| 9729 | { |
| 9730 | return atomic_fetch_add_explicit(const_cast<volatile atomic_wchar_t*>(__obj), |
| 9731 | __v, __o); |
| 9732 | } |
| 9733 | |
| 9734 | inline _LIBCPP_INLINE_VISIBILITY |
| 9735 | wchar_t |
| 9736 | atomic_fetch_sub(volatile atomic_wchar_t* __obj, wchar_t __v) |
| 9737 | { |
| 9738 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 9739 | } |
| 9740 | |
| 9741 | inline _LIBCPP_INLINE_VISIBILITY |
| 9742 | wchar_t |
| 9743 | atomic_fetch_sub(atomic_wchar_t* __obj, wchar_t __v) |
| 9744 | { |
| 9745 | return atomic_fetch_sub(const_cast<volatile atomic_wchar_t*>(__obj), __v); |
| 9746 | } |
| 9747 | |
| 9748 | inline _LIBCPP_INLINE_VISIBILITY |
| 9749 | wchar_t |
| 9750 | atomic_fetch_sub_explicit(volatile atomic_wchar_t* __obj, wchar_t __v, |
| 9751 | memory_order __o) |
| 9752 | { |
| 9753 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 9754 | } |
| 9755 | |
| 9756 | inline _LIBCPP_INLINE_VISIBILITY |
| 9757 | wchar_t |
| 9758 | atomic_fetch_sub_explicit(atomic_wchar_t* __obj, wchar_t __v, |
| 9759 | memory_order __o) |
| 9760 | { |
| 9761 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_wchar_t*>(__obj), |
| 9762 | __v, __o); |
| 9763 | } |
| 9764 | |
| 9765 | inline _LIBCPP_INLINE_VISIBILITY |
| 9766 | wchar_t |
| 9767 | atomic_fetch_and(volatile atomic_wchar_t* __obj, wchar_t __v) |
| 9768 | { |
| 9769 | return __atomic_fetch_and(&__obj->__v_, __v, memory_order_seq_cst); |
| 9770 | } |
| 9771 | |
| 9772 | inline _LIBCPP_INLINE_VISIBILITY |
| 9773 | wchar_t |
| 9774 | atomic_fetch_and(atomic_wchar_t* __obj, wchar_t __v) |
| 9775 | { |
| 9776 | return atomic_fetch_and(const_cast<volatile atomic_wchar_t*>(__obj), __v); |
| 9777 | } |
| 9778 | |
| 9779 | inline _LIBCPP_INLINE_VISIBILITY |
| 9780 | wchar_t |
| 9781 | atomic_fetch_and_explicit(volatile atomic_wchar_t* __obj, wchar_t __v, |
| 9782 | memory_order __o) |
| 9783 | { |
| 9784 | return __atomic_fetch_and(&__obj->__v_, __v, __o); |
| 9785 | } |
| 9786 | |
| 9787 | inline _LIBCPP_INLINE_VISIBILITY |
| 9788 | wchar_t |
| 9789 | atomic_fetch_and_explicit(atomic_wchar_t* __obj, wchar_t __v, |
| 9790 | memory_order __o) |
| 9791 | { |
| 9792 | return atomic_fetch_and_explicit(const_cast<volatile atomic_wchar_t*>(__obj), |
| 9793 | __v, __o); |
| 9794 | } |
| 9795 | |
| 9796 | inline _LIBCPP_INLINE_VISIBILITY |
| 9797 | wchar_t |
| 9798 | atomic_fetch_or(volatile atomic_wchar_t* __obj, wchar_t __v) |
| 9799 | { |
| 9800 | return __atomic_fetch_or(&__obj->__v_, __v, memory_order_seq_cst); |
| 9801 | } |
| 9802 | |
| 9803 | inline _LIBCPP_INLINE_VISIBILITY |
| 9804 | wchar_t |
| 9805 | atomic_fetch_or(atomic_wchar_t* __obj, wchar_t __v) |
| 9806 | { |
| 9807 | return atomic_fetch_or(const_cast<volatile atomic_wchar_t*>(__obj), __v); |
| 9808 | } |
| 9809 | |
| 9810 | inline _LIBCPP_INLINE_VISIBILITY |
| 9811 | wchar_t |
| 9812 | atomic_fetch_or_explicit(volatile atomic_wchar_t* __obj, wchar_t __v, |
| 9813 | memory_order __o) |
| 9814 | { |
| 9815 | return __atomic_fetch_or(&__obj->__v_, __v, __o); |
| 9816 | } |
| 9817 | |
| 9818 | inline _LIBCPP_INLINE_VISIBILITY |
| 9819 | wchar_t |
| 9820 | atomic_fetch_or_explicit(atomic_wchar_t* __obj, wchar_t __v, memory_order __o) |
| 9821 | { |
| 9822 | return atomic_fetch_or_explicit(const_cast<volatile atomic_wchar_t*>(__obj), |
| 9823 | __v, __o); |
| 9824 | } |
| 9825 | |
| 9826 | inline _LIBCPP_INLINE_VISIBILITY |
| 9827 | wchar_t |
| 9828 | atomic_fetch_xor(volatile atomic_wchar_t* __obj, wchar_t __v) |
| 9829 | { |
| 9830 | return __atomic_fetch_xor(&__obj->__v_, __v, memory_order_seq_cst); |
| 9831 | } |
| 9832 | |
| 9833 | inline _LIBCPP_INLINE_VISIBILITY |
| 9834 | wchar_t |
| 9835 | atomic_fetch_xor(atomic_wchar_t* __obj, wchar_t __v) |
| 9836 | { |
| 9837 | return atomic_fetch_xor(const_cast<volatile atomic_wchar_t*>(__obj), __v); |
| 9838 | } |
| 9839 | |
| 9840 | inline _LIBCPP_INLINE_VISIBILITY |
| 9841 | wchar_t |
| 9842 | atomic_fetch_xor_explicit(volatile atomic_wchar_t* __obj, wchar_t __v, |
| 9843 | memory_order __o) |
| 9844 | { |
| 9845 | return __atomic_fetch_xor(&__obj->__v_, __v, __o); |
| 9846 | } |
| 9847 | |
| 9848 | inline _LIBCPP_INLINE_VISIBILITY |
| 9849 | wchar_t |
| 9850 | atomic_fetch_xor_explicit(atomic_wchar_t* __obj, wchar_t __v, |
| 9851 | memory_order __o) |
| 9852 | { |
| 9853 | return atomic_fetch_xor_explicit(const_cast<volatile atomic_wchar_t*>(__obj), |
| 9854 | __v, __o); |
| 9855 | } |
| 9856 | |
Howard Hinnant | bce9c31 | 2010-10-21 17:44:19 +0000 | [diff] [blame] | 9857 | // atomic_address |
| 9858 | |
| 9859 | struct atomic_address; |
| 9860 | |
| 9861 | bool atomic_is_lock_free(const volatile atomic_address*); |
| 9862 | bool atomic_is_lock_free(const atomic_address*); |
| 9863 | void atomic_init(volatile atomic_address*, void*); |
| 9864 | void atomic_init(atomic_address*, void*); |
| 9865 | void atomic_store(volatile atomic_address*, void*); |
| 9866 | void atomic_store(atomic_address*, void*); |
| 9867 | void atomic_store_explicit(volatile atomic_address*, void*, memory_order); |
| 9868 | void atomic_store_explicit(atomic_address*, void*, memory_order); |
| 9869 | void* atomic_load(const volatile atomic_address*); |
| 9870 | void* atomic_load(const atomic_address*); |
| 9871 | void* atomic_load_explicit(const volatile atomic_address*, memory_order); |
| 9872 | void* atomic_load_explicit(const atomic_address*, memory_order); |
| 9873 | void* atomic_exchange(volatile atomic_address*, void*); |
| 9874 | void* atomic_exchange(atomic_address*, void*); |
| 9875 | void* atomic_exchange_explicit(volatile atomic_address*, void*, memory_order); |
| 9876 | void* atomic_exchange_explicit(atomic_address*, void*, memory_order); |
| 9877 | bool atomic_compare_exchange_weak(volatile atomic_address*, void**, void*); |
| 9878 | bool atomic_compare_exchange_weak(atomic_address*, void**, void*); |
| 9879 | bool atomic_compare_exchange_strong(volatile atomic_address*, void**, void*); |
| 9880 | bool atomic_compare_exchange_strong(atomic_address*, void**, void*); |
| 9881 | bool atomic_compare_exchange_weak_explicit(volatile atomic_address*, void**, |
| 9882 | void*, memory_order, memory_order); |
| 9883 | bool atomic_compare_exchange_weak_explicit(atomic_address*, void**, |
| 9884 | void*, memory_order, memory_order); |
| 9885 | bool atomic_compare_exchange_strong_explicit(volatile atomic_address*, void**, |
| 9886 | void*, memory_order, memory_order); |
| 9887 | bool atomic_compare_exchange_strong_explicit(atomic_address*, void**, |
| 9888 | void*, memory_order, memory_order); |
| 9889 | void* atomic_fetch_add(volatile atomic_address*, ptrdiff_t); |
| 9890 | void* atomic_fetch_add(atomic_address*, ptrdiff_t); |
| 9891 | void* atomic_fetch_add_explicit(volatile atomic_address*, ptrdiff_t, |
| 9892 | memory_order); |
| 9893 | void* atomic_fetch_add_explicit(atomic_address*, ptrdiff_t, memory_order); |
| 9894 | void* atomic_fetch_sub(volatile atomic_address*, ptrdiff_t); |
| 9895 | void* atomic_fetch_sub(atomic_address*, ptrdiff_t); |
| 9896 | void* atomic_fetch_sub_explicit(volatile atomic_address*, ptrdiff_t, |
| 9897 | memory_order); |
| 9898 | void* atomic_fetch_sub_explicit(atomic_address*, ptrdiff_t, memory_order); |
| 9899 | |
| 9900 | typedef struct atomic_address |
| 9901 | { |
| 9902 | void* __v_; |
| 9903 | |
| 9904 | _LIBCPP_INLINE_VISIBILITY |
| 9905 | bool is_lock_free() const volatile |
| 9906 | {return atomic_is_lock_free(this);} |
| 9907 | _LIBCPP_INLINE_VISIBILITY |
| 9908 | bool is_lock_free() const |
| 9909 | {return atomic_is_lock_free(this);} |
| 9910 | _LIBCPP_INLINE_VISIBILITY |
| 9911 | void store(void* __v, memory_order __o = memory_order_seq_cst) volatile |
| 9912 | {atomic_store_explicit(this, __v, __o);} |
| 9913 | _LIBCPP_INLINE_VISIBILITY |
| 9914 | void store(void* __v, memory_order __o = memory_order_seq_cst) |
| 9915 | {atomic_store_explicit(this, __v, __o);} |
| 9916 | _LIBCPP_INLINE_VISIBILITY |
| 9917 | void* load(memory_order __o = memory_order_seq_cst) const volatile |
| 9918 | {return atomic_load_explicit(this, __o);} |
| 9919 | _LIBCPP_INLINE_VISIBILITY |
| 9920 | void* load(memory_order __o = memory_order_seq_cst) const |
| 9921 | {return atomic_load_explicit(this, __o);} |
| 9922 | _LIBCPP_INLINE_VISIBILITY |
| 9923 | operator void*() const volatile |
| 9924 | {return load();} |
| 9925 | _LIBCPP_INLINE_VISIBILITY |
| 9926 | operator void*() const |
| 9927 | {return load();} |
| 9928 | _LIBCPP_INLINE_VISIBILITY |
| 9929 | void* exchange(void* __v, memory_order __o = memory_order_seq_cst) volatile |
| 9930 | {return atomic_exchange_explicit(this, __v, __o);} |
| 9931 | _LIBCPP_INLINE_VISIBILITY |
| 9932 | void* exchange(void* __v, memory_order __o = memory_order_seq_cst) |
| 9933 | {return atomic_exchange_explicit(this, __v, __o);} |
| 9934 | _LIBCPP_INLINE_VISIBILITY |
| 9935 | bool compare_exchange_weak(void*& __v, void* __e, memory_order __s, |
| 9936 | memory_order __f) volatile |
| 9937 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 9938 | __f);} |
| 9939 | _LIBCPP_INLINE_VISIBILITY |
| 9940 | bool compare_exchange_weak(void*& __v, void* __e, memory_order __s, |
| 9941 | memory_order __f) |
| 9942 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 9943 | __f);} |
| 9944 | _LIBCPP_INLINE_VISIBILITY |
| 9945 | bool compare_exchange_strong(void*& __v, void* __e, memory_order __s, |
| 9946 | memory_order __f) volatile |
| 9947 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 9948 | __f);} |
| 9949 | _LIBCPP_INLINE_VISIBILITY |
| 9950 | bool compare_exchange_strong(void*& __v, void* __e, memory_order __s, |
| 9951 | memory_order __f) |
| 9952 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 9953 | __f);} |
| 9954 | _LIBCPP_INLINE_VISIBILITY |
| 9955 | bool compare_exchange_weak(void*& __v, void* __e, |
| 9956 | memory_order __s = memory_order_seq_cst) volatile |
| 9957 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 9958 | __translate_memory_order(__s));} |
| 9959 | _LIBCPP_INLINE_VISIBILITY |
| 9960 | bool compare_exchange_weak(void*& __v, void* __e, |
| 9961 | memory_order __s = memory_order_seq_cst) |
| 9962 | {return atomic_compare_exchange_weak_explicit(this, &__v, __e, __s, |
| 9963 | __translate_memory_order(__s));} |
| 9964 | _LIBCPP_INLINE_VISIBILITY |
| 9965 | bool compare_exchange_strong(void*& __v, void* __e, |
| 9966 | memory_order __s = memory_order_seq_cst) volatile |
| 9967 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 9968 | __translate_memory_order(__s));} |
| 9969 | _LIBCPP_INLINE_VISIBILITY |
| 9970 | bool compare_exchange_strong(void*& __v, void* __e, |
| 9971 | memory_order __s = memory_order_seq_cst) |
| 9972 | {return atomic_compare_exchange_strong_explicit(this, &__v, __e, __s, |
| 9973 | __translate_memory_order(__s));} |
| 9974 | _LIBCPP_INLINE_VISIBILITY |
| 9975 | bool compare_exchange_weak(const void*& __v, const void* __e, |
| 9976 | memory_order __s, memory_order __f) volatile |
| 9977 | {return atomic_compare_exchange_weak_explicit(this, |
| 9978 | &const_cast<void*&>(__v), const_cast<void*>(__e), __s, __f);} |
| 9979 | _LIBCPP_INLINE_VISIBILITY |
| 9980 | bool compare_exchange_weak(const void*& __v, const void* __e, |
| 9981 | memory_order __s, memory_order __f) |
| 9982 | {return atomic_compare_exchange_weak_explicit(this, |
| 9983 | &const_cast<void*&>(__v), const_cast<void*>(__e), __s, __f);} |
| 9984 | _LIBCPP_INLINE_VISIBILITY |
| 9985 | bool compare_exchange_strong(const void*& __v, const void* __e, |
| 9986 | memory_order __s, memory_order __f) volatile |
| 9987 | {return atomic_compare_exchange_strong_explicit(this, |
| 9988 | &const_cast<void*&>(__v), const_cast<void*>(__e), __s, __f);} |
| 9989 | _LIBCPP_INLINE_VISIBILITY |
| 9990 | bool compare_exchange_strong(const void*& __v, const void* __e, |
| 9991 | memory_order __s, memory_order __f) |
| 9992 | {return atomic_compare_exchange_strong_explicit(this, |
| 9993 | &const_cast<void*&>(__v), const_cast<void*>(__e), __s, __f);} |
| 9994 | _LIBCPP_INLINE_VISIBILITY |
| 9995 | bool compare_exchange_weak(const void*& __v, const void* __e, |
| 9996 | memory_order __s = memory_order_seq_cst) volatile |
| 9997 | {return atomic_compare_exchange_weak_explicit(this, |
| 9998 | &const_cast<void*&>(__v), const_cast<void*>(__e), |
| 9999 | __s, __translate_memory_order(__s));} |
| 10000 | _LIBCPP_INLINE_VISIBILITY |
| 10001 | bool compare_exchange_weak(const void*& __v, const void* __e, |
| 10002 | memory_order __s = memory_order_seq_cst) |
| 10003 | {return atomic_compare_exchange_weak_explicit(this, |
| 10004 | &const_cast<void*&>(__v), const_cast<void*>(__e), |
| 10005 | __s, __translate_memory_order(__s));} |
| 10006 | _LIBCPP_INLINE_VISIBILITY |
| 10007 | bool compare_exchange_strong(const void*& __v, const void* __e, |
| 10008 | memory_order __s = memory_order_seq_cst) volatile |
| 10009 | {return atomic_compare_exchange_strong_explicit(this, |
| 10010 | &const_cast<void*&>(__v), const_cast<void*>(__e), |
| 10011 | __s, __translate_memory_order(__s));} |
| 10012 | _LIBCPP_INLINE_VISIBILITY |
| 10013 | bool compare_exchange_strong(const void*& __v, const void* __e, |
| 10014 | memory_order __s = memory_order_seq_cst) |
| 10015 | {return atomic_compare_exchange_strong_explicit(this, |
| 10016 | &const_cast<void*&>(__v), const_cast<void*>(__e), |
| 10017 | __s, __translate_memory_order(__s));} |
| 10018 | _LIBCPP_INLINE_VISIBILITY |
| 10019 | void* fetch_add(ptrdiff_t __v, |
| 10020 | memory_order __o = memory_order_seq_cst) volatile |
| 10021 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 10022 | _LIBCPP_INLINE_VISIBILITY |
| 10023 | void* fetch_add(ptrdiff_t __v, memory_order __o = memory_order_seq_cst) |
| 10024 | {return atomic_fetch_add_explicit(this, __v, __o);} |
| 10025 | _LIBCPP_INLINE_VISIBILITY |
| 10026 | void* fetch_sub(ptrdiff_t __v, |
| 10027 | memory_order __o = memory_order_seq_cst) volatile |
| 10028 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 10029 | _LIBCPP_INLINE_VISIBILITY |
| 10030 | void* fetch_sub(ptrdiff_t __v, memory_order __o = memory_order_seq_cst) |
| 10031 | {return atomic_fetch_sub_explicit(this, __v, __o);} |
| 10032 | #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 10033 | atomic_address() = default; |
| 10034 | #else |
| 10035 | _LIBCPP_INLINE_VISIBILITY |
| 10036 | atomic_address() {} |
| 10037 | #endif |
| 10038 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 10039 | constexpr atomic_address(void* __v) |
Howard Hinnant | bce9c31 | 2010-10-21 17:44:19 +0000 | [diff] [blame] | 10040 | : __v_(__v) {} |
| 10041 | #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 10042 | atomic_address(const atomic_address&) = delete; |
| 10043 | atomic_address& operator=(const atomic_address&) = delete; |
| 10044 | atomic_address& operator=(const atomic_address&) volatile = delete; |
| 10045 | #else |
| 10046 | private: |
| 10047 | atomic_address(const atomic_address&); |
| 10048 | atomic_address& operator=(const atomic_address&); |
| 10049 | atomic_address& operator=(const atomic_address&) volatile; |
| 10050 | public: |
| 10051 | #endif |
| 10052 | _LIBCPP_INLINE_VISIBILITY |
| 10053 | void* operator=(const void* __v) volatile |
| 10054 | {store(const_cast<void*>(__v)); return const_cast<void*>(__v);} |
| 10055 | _LIBCPP_INLINE_VISIBILITY |
| 10056 | void* operator=(const void* __v) |
| 10057 | {store(const_cast<void*>(__v)); return const_cast<void*>(__v);} |
| 10058 | _LIBCPP_INLINE_VISIBILITY |
| 10059 | void* operator+=(ptrdiff_t __v) volatile |
| 10060 | {return static_cast<char*>(fetch_add(__v)) + __v;} |
| 10061 | _LIBCPP_INLINE_VISIBILITY |
| 10062 | void* operator+=(ptrdiff_t __v) |
| 10063 | {return static_cast<char*>(fetch_add(__v)) + __v;} |
| 10064 | _LIBCPP_INLINE_VISIBILITY |
| 10065 | void* operator-=(ptrdiff_t __v) volatile |
| 10066 | {return static_cast<char*>(fetch_sub(__v)) - __v;} |
| 10067 | _LIBCPP_INLINE_VISIBILITY |
| 10068 | void* operator-=(ptrdiff_t __v) |
| 10069 | {return static_cast<char*>(fetch_sub(__v)) - __v;} |
| 10070 | } atomic_address; |
| 10071 | |
| 10072 | inline _LIBCPP_INLINE_VISIBILITY |
| 10073 | bool |
| 10074 | atomic_is_lock_free(const volatile atomic_address*) |
| 10075 | { |
| 10076 | typedef void* type; |
| 10077 | return __atomic_is_lock_free(type); |
| 10078 | } |
| 10079 | |
| 10080 | inline _LIBCPP_INLINE_VISIBILITY |
| 10081 | bool |
| 10082 | atomic_is_lock_free(const atomic_address* __obj) |
| 10083 | { |
| 10084 | return atomic_is_lock_free(const_cast<volatile atomic_address*>(__obj)); |
| 10085 | } |
| 10086 | |
| 10087 | inline _LIBCPP_INLINE_VISIBILITY |
| 10088 | void |
| 10089 | atomic_init(volatile atomic_address* __obj, void* __desr) |
| 10090 | { |
| 10091 | __obj->__v_ = __desr; |
| 10092 | } |
| 10093 | |
| 10094 | inline _LIBCPP_INLINE_VISIBILITY |
| 10095 | void |
| 10096 | atomic_init(atomic_address* __obj, void* __desr) |
| 10097 | { |
| 10098 | __obj->__v_ = __desr; |
| 10099 | } |
| 10100 | |
| 10101 | inline _LIBCPP_INLINE_VISIBILITY |
| 10102 | void |
| 10103 | atomic_store(volatile atomic_address* __obj, void* __desr) |
| 10104 | { |
| 10105 | __atomic_store(&__obj->__v_, __desr, memory_order_seq_cst); |
| 10106 | } |
| 10107 | |
| 10108 | inline _LIBCPP_INLINE_VISIBILITY |
| 10109 | void |
| 10110 | atomic_store(atomic_address* __obj, void* __desr) |
| 10111 | { |
| 10112 | atomic_store(const_cast<volatile atomic_address*>(__obj), __desr); |
| 10113 | } |
| 10114 | |
| 10115 | inline _LIBCPP_INLINE_VISIBILITY |
| 10116 | void |
| 10117 | atomic_store_explicit(volatile atomic_address* __obj, void* __desr, |
| 10118 | memory_order __o) |
| 10119 | { |
| 10120 | __atomic_store(&__obj->__v_, __desr, __o); |
| 10121 | } |
| 10122 | |
| 10123 | inline _LIBCPP_INLINE_VISIBILITY |
| 10124 | void |
| 10125 | atomic_store_explicit(atomic_address* __obj, void* __desr, memory_order __o) |
| 10126 | { |
| 10127 | atomic_store_explicit(const_cast<volatile atomic_address*>(__obj), __desr, |
| 10128 | __o); |
| 10129 | } |
| 10130 | |
| 10131 | inline _LIBCPP_INLINE_VISIBILITY |
| 10132 | void* |
| 10133 | atomic_load(const volatile atomic_address* __obj) |
| 10134 | { |
| 10135 | return __atomic_load(&__obj->__v_, memory_order_seq_cst); |
| 10136 | } |
| 10137 | |
| 10138 | inline _LIBCPP_INLINE_VISIBILITY |
| 10139 | void* |
| 10140 | atomic_load(const atomic_address* __obj) |
| 10141 | { |
| 10142 | return atomic_load(const_cast<const volatile atomic_address*>(__obj)); |
| 10143 | } |
| 10144 | |
| 10145 | inline _LIBCPP_INLINE_VISIBILITY |
| 10146 | void* |
| 10147 | atomic_load_explicit(const volatile atomic_address* __obj, memory_order __o) |
| 10148 | { |
| 10149 | return __atomic_load(&__obj->__v_, __o); |
| 10150 | } |
| 10151 | |
| 10152 | inline _LIBCPP_INLINE_VISIBILITY |
| 10153 | void* |
| 10154 | atomic_load_explicit(const atomic_address* __obj, memory_order __o) |
| 10155 | { |
| 10156 | return atomic_load_explicit(const_cast<const volatile atomic_address*> |
| 10157 | (__obj), __o); |
| 10158 | } |
| 10159 | |
| 10160 | inline _LIBCPP_INLINE_VISIBILITY |
| 10161 | void* |
| 10162 | atomic_exchange(volatile atomic_address* __obj, void* __desr) |
| 10163 | { |
| 10164 | return __atomic_exchange(&__obj->__v_, __desr, memory_order_seq_cst); |
| 10165 | } |
| 10166 | |
| 10167 | inline _LIBCPP_INLINE_VISIBILITY |
| 10168 | void* |
| 10169 | atomic_exchange(atomic_address* __obj, void* __desr) |
| 10170 | { |
| 10171 | return atomic_exchange(const_cast<volatile atomic_address*>(__obj), __desr); |
| 10172 | } |
| 10173 | |
| 10174 | inline _LIBCPP_INLINE_VISIBILITY |
| 10175 | void* |
| 10176 | atomic_exchange_explicit(volatile atomic_address* __obj, void* __desr, |
| 10177 | memory_order __o) |
| 10178 | { |
| 10179 | return __atomic_exchange(&__obj->__v_, __desr, __o); |
| 10180 | } |
| 10181 | |
| 10182 | inline _LIBCPP_INLINE_VISIBILITY |
| 10183 | void* |
| 10184 | atomic_exchange_explicit(atomic_address* __obj, void* __desr, memory_order __o) |
| 10185 | { |
| 10186 | return atomic_exchange_explicit(const_cast<volatile atomic_address*> |
| 10187 | (__obj), __desr, __o); |
| 10188 | } |
| 10189 | |
| 10190 | inline _LIBCPP_INLINE_VISIBILITY |
| 10191 | bool |
| 10192 | atomic_compare_exchange_weak(volatile atomic_address* __obj, void** __exp, |
| 10193 | void* __desr) |
| 10194 | { |
| 10195 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, |
| 10196 | memory_order_seq_cst, memory_order_seq_cst); |
| 10197 | } |
| 10198 | |
| 10199 | inline _LIBCPP_INLINE_VISIBILITY |
| 10200 | bool |
| 10201 | atomic_compare_exchange_weak(atomic_address* __obj, void** __exp, void* __desr) |
| 10202 | { |
| 10203 | return atomic_compare_exchange_weak(const_cast<volatile atomic_address*> |
| 10204 | (__obj), __exp, __desr); |
| 10205 | } |
| 10206 | |
| 10207 | inline _LIBCPP_INLINE_VISIBILITY |
| 10208 | bool |
| 10209 | atomic_compare_exchange_strong(volatile atomic_address* __obj, void** __exp, |
| 10210 | void* __desr) |
| 10211 | { |
| 10212 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, |
| 10213 | memory_order_seq_cst, memory_order_seq_cst); |
| 10214 | } |
| 10215 | |
| 10216 | inline _LIBCPP_INLINE_VISIBILITY |
| 10217 | bool |
| 10218 | atomic_compare_exchange_strong(atomic_address* __obj, void** __exp, |
| 10219 | void* __desr) |
| 10220 | { |
| 10221 | return atomic_compare_exchange_strong(const_cast<volatile atomic_address*> |
| 10222 | (__obj), __exp, __desr); |
| 10223 | } |
| 10224 | |
| 10225 | inline _LIBCPP_INLINE_VISIBILITY |
| 10226 | bool |
| 10227 | atomic_compare_exchange_weak_explicit(volatile atomic_address* __obj, |
| 10228 | void** __exp, void* __desr, |
| 10229 | memory_order __s, memory_order __f) |
| 10230 | { |
| 10231 | return __atomic_compare_exchange_weak(&__obj->__v_, __exp, __desr, __s, |
| 10232 | __f); |
| 10233 | } |
| 10234 | |
| 10235 | inline _LIBCPP_INLINE_VISIBILITY |
| 10236 | bool |
| 10237 | atomic_compare_exchange_weak_explicit(atomic_address* __obj, void** __exp, |
| 10238 | void* __desr, memory_order __s, |
| 10239 | memory_order __f) |
| 10240 | { |
| 10241 | return atomic_compare_exchange_weak_explicit( |
| 10242 | const_cast<volatile atomic_address*>(__obj), __exp, __desr, __s, __f); |
| 10243 | } |
| 10244 | |
| 10245 | inline _LIBCPP_INLINE_VISIBILITY |
| 10246 | bool |
| 10247 | atomic_compare_exchange_strong_explicit(volatile atomic_address* __obj, |
| 10248 | void** __exp, void* __desr, |
| 10249 | memory_order __s, memory_order __f) |
| 10250 | { |
| 10251 | return __atomic_compare_exchange_strong(&__obj->__v_, __exp, __desr, __s, |
| 10252 | __f); |
| 10253 | } |
| 10254 | |
| 10255 | inline _LIBCPP_INLINE_VISIBILITY |
| 10256 | bool |
| 10257 | atomic_compare_exchange_strong_explicit(atomic_address* __obj, void** __exp, |
| 10258 | void* __desr, memory_order __s, |
| 10259 | memory_order __f) |
| 10260 | { |
| 10261 | return atomic_compare_exchange_strong_explicit( |
| 10262 | const_cast<volatile atomic_address*>(__obj), __exp, __desr, __s, __f); |
| 10263 | } |
| 10264 | |
| 10265 | inline _LIBCPP_INLINE_VISIBILITY |
| 10266 | void* |
| 10267 | atomic_fetch_add(volatile atomic_address* __obj, ptrdiff_t __v) |
| 10268 | { |
| 10269 | return __atomic_fetch_add(&__obj->__v_, __v, memory_order_seq_cst); |
| 10270 | } |
| 10271 | |
| 10272 | inline _LIBCPP_INLINE_VISIBILITY |
| 10273 | void* |
| 10274 | atomic_fetch_add(atomic_address* __obj, ptrdiff_t __v) |
| 10275 | { |
| 10276 | return atomic_fetch_add(const_cast<volatile atomic_address*>(__obj), __v); |
| 10277 | } |
| 10278 | |
| 10279 | inline _LIBCPP_INLINE_VISIBILITY |
| 10280 | void* |
| 10281 | atomic_fetch_add_explicit(volatile atomic_address* __obj, ptrdiff_t __v, |
| 10282 | memory_order __o) |
| 10283 | { |
| 10284 | return __atomic_fetch_add(&__obj->__v_, __v, __o); |
| 10285 | } |
| 10286 | |
| 10287 | inline _LIBCPP_INLINE_VISIBILITY |
| 10288 | void* |
| 10289 | atomic_fetch_add_explicit(atomic_address* __obj, ptrdiff_t __v, |
| 10290 | memory_order __o) |
| 10291 | { |
| 10292 | return atomic_fetch_add_explicit(const_cast<volatile atomic_address*>(__obj), |
| 10293 | __v, __o); |
| 10294 | } |
| 10295 | |
| 10296 | inline _LIBCPP_INLINE_VISIBILITY |
| 10297 | void* |
| 10298 | atomic_fetch_sub(volatile atomic_address* __obj, ptrdiff_t __v) |
| 10299 | { |
| 10300 | return __atomic_fetch_sub(&__obj->__v_, __v, memory_order_seq_cst); |
| 10301 | } |
| 10302 | |
| 10303 | inline _LIBCPP_INLINE_VISIBILITY |
| 10304 | void* |
| 10305 | atomic_fetch_sub(atomic_address* __obj, ptrdiff_t __v) |
| 10306 | { |
| 10307 | return atomic_fetch_sub(const_cast<volatile atomic_address*>(__obj), __v); |
| 10308 | } |
| 10309 | |
| 10310 | inline _LIBCPP_INLINE_VISIBILITY |
| 10311 | void* |
| 10312 | atomic_fetch_sub_explicit(volatile atomic_address* __obj, ptrdiff_t __v, |
| 10313 | memory_order __o) |
| 10314 | { |
| 10315 | return __atomic_fetch_sub(&__obj->__v_, __v, __o); |
| 10316 | } |
| 10317 | |
| 10318 | inline _LIBCPP_INLINE_VISIBILITY |
| 10319 | void* |
| 10320 | atomic_fetch_sub_explicit(atomic_address* __obj, ptrdiff_t __v, |
| 10321 | memory_order __o) |
| 10322 | { |
| 10323 | return atomic_fetch_sub_explicit(const_cast<volatile atomic_address*>(__obj), |
| 10324 | __v, __o); |
| 10325 | } |
Howard Hinnant | 4777bf2 | 2010-12-06 23:10:08 +0000 | [diff] [blame^] | 10326 | */ |
Howard Hinnant | 8f73c63 | 2010-09-27 21:17:38 +0000 | [diff] [blame] | 10327 | _LIBCPP_END_NAMESPACE_STD |
| 10328 | |
| 10329 | #endif // _LIBCPP_ATOMIC |