1*58b9f456SAndroid Build Coastguard Worker// -*- C++ -*- 2*58b9f456SAndroid Build Coastguard Worker//===--------------------------- atomic -----------------------------------===// 3*58b9f456SAndroid Build Coastguard Worker// 4*58b9f456SAndroid Build Coastguard Worker// The LLVM Compiler Infrastructure 5*58b9f456SAndroid Build Coastguard Worker// 6*58b9f456SAndroid Build Coastguard Worker// This file is distributed under the University of Illinois Open Source 7*58b9f456SAndroid Build Coastguard Worker// License. See LICENSE.TXT for details. 8*58b9f456SAndroid Build Coastguard Worker// 9*58b9f456SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 10*58b9f456SAndroid Build Coastguard Worker 11*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_ATOMIC 12*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_ATOMIC 13*58b9f456SAndroid Build Coastguard Worker 14*58b9f456SAndroid Build Coastguard Worker/* 15*58b9f456SAndroid Build Coastguard Worker atomic synopsis 16*58b9f456SAndroid Build Coastguard Worker 17*58b9f456SAndroid Build Coastguard Workernamespace std 18*58b9f456SAndroid Build Coastguard Worker{ 19*58b9f456SAndroid Build Coastguard Worker 20*58b9f456SAndroid Build Coastguard Worker// feature test macro 21*58b9f456SAndroid Build Coastguard Worker 22*58b9f456SAndroid Build Coastguard Worker#define __cpp_lib_atomic_is_always_lock_free // as specified by SG10 23*58b9f456SAndroid Build Coastguard Worker 24*58b9f456SAndroid Build Coastguard Worker// order and consistency 25*58b9f456SAndroid Build Coastguard Worker 26*58b9f456SAndroid Build Coastguard Workertypedef enum memory_order 27*58b9f456SAndroid Build Coastguard Worker{ 28*58b9f456SAndroid Build Coastguard Worker memory_order_relaxed, 29*58b9f456SAndroid Build Coastguard Worker memory_order_consume, // load-consume 30*58b9f456SAndroid Build Coastguard Worker memory_order_acquire, // load-acquire 31*58b9f456SAndroid Build Coastguard Worker memory_order_release, // store-release 32*58b9f456SAndroid Build Coastguard Worker memory_order_acq_rel, // store-release load-acquire 33*58b9f456SAndroid Build Coastguard Worker memory_order_seq_cst // store-release load-acquire 34*58b9f456SAndroid Build Coastguard Worker} memory_order; 35*58b9f456SAndroid Build Coastguard Worker 36*58b9f456SAndroid Build Coastguard Workertemplate <class T> T kill_dependency(T y) noexcept; 37*58b9f456SAndroid Build Coastguard Worker 38*58b9f456SAndroid Build Coastguard Worker// lock-free property 39*58b9f456SAndroid Build Coastguard Worker 40*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_BOOL_LOCK_FREE unspecified 41*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_CHAR_LOCK_FREE unspecified 42*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_CHAR16_T_LOCK_FREE unspecified 43*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_CHAR32_T_LOCK_FREE unspecified 44*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_WCHAR_T_LOCK_FREE unspecified 45*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_SHORT_LOCK_FREE unspecified 46*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_INT_LOCK_FREE unspecified 47*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_LONG_LOCK_FREE unspecified 48*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_LLONG_LOCK_FREE unspecified 49*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_POINTER_LOCK_FREE unspecified 50*58b9f456SAndroid Build Coastguard Worker 51*58b9f456SAndroid Build Coastguard Worker// flag type and operations 52*58b9f456SAndroid Build Coastguard Worker 53*58b9f456SAndroid Build Coastguard Workertypedef struct atomic_flag 54*58b9f456SAndroid Build Coastguard Worker{ 55*58b9f456SAndroid Build Coastguard Worker bool test_and_set(memory_order m = memory_order_seq_cst) volatile noexcept; 56*58b9f456SAndroid Build Coastguard Worker bool test_and_set(memory_order m = memory_order_seq_cst) noexcept; 57*58b9f456SAndroid Build Coastguard Worker void clear(memory_order m = memory_order_seq_cst) volatile noexcept; 58*58b9f456SAndroid Build Coastguard Worker void clear(memory_order m = memory_order_seq_cst) noexcept; 59*58b9f456SAndroid Build Coastguard Worker atomic_flag() noexcept = default; 60*58b9f456SAndroid Build Coastguard Worker atomic_flag(const atomic_flag&) = delete; 61*58b9f456SAndroid Build Coastguard Worker atomic_flag& operator=(const atomic_flag&) = delete; 62*58b9f456SAndroid Build Coastguard Worker atomic_flag& operator=(const atomic_flag&) volatile = delete; 63*58b9f456SAndroid Build Coastguard Worker} atomic_flag; 64*58b9f456SAndroid Build Coastguard Worker 65*58b9f456SAndroid Build Coastguard Workerbool 66*58b9f456SAndroid Build Coastguard Worker atomic_flag_test_and_set(volatile atomic_flag* obj) noexcept; 67*58b9f456SAndroid Build Coastguard Worker 68*58b9f456SAndroid Build Coastguard Workerbool 69*58b9f456SAndroid Build Coastguard Worker atomic_flag_test_and_set(atomic_flag* obj) noexcept; 70*58b9f456SAndroid Build Coastguard Worker 71*58b9f456SAndroid Build Coastguard Workerbool 72*58b9f456SAndroid Build Coastguard Worker atomic_flag_test_and_set_explicit(volatile atomic_flag* obj, 73*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 74*58b9f456SAndroid Build Coastguard Worker 75*58b9f456SAndroid Build Coastguard Workerbool 76*58b9f456SAndroid Build Coastguard Worker atomic_flag_test_and_set_explicit(atomic_flag* obj, memory_order m) noexcept; 77*58b9f456SAndroid Build Coastguard Worker 78*58b9f456SAndroid Build Coastguard Workervoid 79*58b9f456SAndroid Build Coastguard Worker atomic_flag_clear(volatile atomic_flag* obj) noexcept; 80*58b9f456SAndroid Build Coastguard Worker 81*58b9f456SAndroid Build Coastguard Workervoid 82*58b9f456SAndroid Build Coastguard Worker atomic_flag_clear(atomic_flag* obj) noexcept; 83*58b9f456SAndroid Build Coastguard Worker 84*58b9f456SAndroid Build Coastguard Workervoid 85*58b9f456SAndroid Build Coastguard Worker atomic_flag_clear_explicit(volatile atomic_flag* obj, memory_order m) noexcept; 86*58b9f456SAndroid Build Coastguard Worker 87*58b9f456SAndroid Build Coastguard Workervoid 88*58b9f456SAndroid Build Coastguard Worker atomic_flag_clear_explicit(atomic_flag* obj, memory_order m) noexcept; 89*58b9f456SAndroid Build Coastguard Worker 90*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_FLAG_INIT see below 91*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_VAR_INIT(value) see below 92*58b9f456SAndroid Build Coastguard Worker 93*58b9f456SAndroid Build Coastguard Workertemplate <class T> 94*58b9f456SAndroid Build Coastguard Workerstruct atomic 95*58b9f456SAndroid Build Coastguard Worker{ 96*58b9f456SAndroid Build Coastguard Worker static constexpr bool is_always_lock_free; 97*58b9f456SAndroid Build Coastguard Worker bool is_lock_free() const volatile noexcept; 98*58b9f456SAndroid Build Coastguard Worker bool is_lock_free() const noexcept; 99*58b9f456SAndroid Build Coastguard Worker void store(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; 100*58b9f456SAndroid Build Coastguard Worker void store(T desr, memory_order m = memory_order_seq_cst) noexcept; 101*58b9f456SAndroid Build Coastguard Worker T load(memory_order m = memory_order_seq_cst) const volatile noexcept; 102*58b9f456SAndroid Build Coastguard Worker T load(memory_order m = memory_order_seq_cst) const noexcept; 103*58b9f456SAndroid Build Coastguard Worker operator T() const volatile noexcept; 104*58b9f456SAndroid Build Coastguard Worker operator T() const noexcept; 105*58b9f456SAndroid Build Coastguard Worker T exchange(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; 106*58b9f456SAndroid Build Coastguard Worker T exchange(T desr, memory_order m = memory_order_seq_cst) noexcept; 107*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(T& expc, T desr, 108*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) volatile noexcept; 109*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f) noexcept; 110*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(T& expc, T desr, 111*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) volatile noexcept; 112*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(T& expc, T desr, 113*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) noexcept; 114*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(T& expc, T desr, 115*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) volatile noexcept; 116*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(T& expc, T desr, 117*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) noexcept; 118*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(T& expc, T desr, 119*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) volatile noexcept; 120*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(T& expc, T desr, 121*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) noexcept; 122*58b9f456SAndroid Build Coastguard Worker 123*58b9f456SAndroid Build Coastguard Worker atomic() noexcept = default; 124*58b9f456SAndroid Build Coastguard Worker constexpr atomic(T desr) noexcept; 125*58b9f456SAndroid Build Coastguard Worker atomic(const atomic&) = delete; 126*58b9f456SAndroid Build Coastguard Worker atomic& operator=(const atomic&) = delete; 127*58b9f456SAndroid Build Coastguard Worker atomic& operator=(const atomic&) volatile = delete; 128*58b9f456SAndroid Build Coastguard Worker T operator=(T) volatile noexcept; 129*58b9f456SAndroid Build Coastguard Worker T operator=(T) noexcept; 130*58b9f456SAndroid Build Coastguard Worker}; 131*58b9f456SAndroid Build Coastguard Worker 132*58b9f456SAndroid Build Coastguard Workertemplate <> 133*58b9f456SAndroid Build Coastguard Workerstruct atomic<integral> 134*58b9f456SAndroid Build Coastguard Worker{ 135*58b9f456SAndroid Build Coastguard Worker static constexpr bool is_always_lock_free; 136*58b9f456SAndroid Build Coastguard Worker bool is_lock_free() const volatile noexcept; 137*58b9f456SAndroid Build Coastguard Worker bool is_lock_free() const noexcept; 138*58b9f456SAndroid Build Coastguard Worker void store(integral desr, memory_order m = memory_order_seq_cst) volatile noexcept; 139*58b9f456SAndroid Build Coastguard Worker void store(integral desr, memory_order m = memory_order_seq_cst) noexcept; 140*58b9f456SAndroid Build Coastguard Worker integral load(memory_order m = memory_order_seq_cst) const volatile noexcept; 141*58b9f456SAndroid Build Coastguard Worker integral load(memory_order m = memory_order_seq_cst) const noexcept; 142*58b9f456SAndroid Build Coastguard Worker operator integral() const volatile noexcept; 143*58b9f456SAndroid Build Coastguard Worker operator integral() const noexcept; 144*58b9f456SAndroid Build Coastguard Worker integral exchange(integral desr, 145*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) volatile noexcept; 146*58b9f456SAndroid Build Coastguard Worker integral exchange(integral desr, memory_order m = memory_order_seq_cst) noexcept; 147*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(integral& expc, integral desr, 148*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) volatile noexcept; 149*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(integral& expc, integral desr, 150*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) noexcept; 151*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(integral& expc, integral desr, 152*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) volatile noexcept; 153*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(integral& expc, integral desr, 154*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) noexcept; 155*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(integral& expc, integral desr, 156*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) volatile noexcept; 157*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(integral& expc, integral desr, 158*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) noexcept; 159*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(integral& expc, integral desr, 160*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) volatile noexcept; 161*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(integral& expc, integral desr, 162*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) noexcept; 163*58b9f456SAndroid Build Coastguard Worker 164*58b9f456SAndroid Build Coastguard Worker integral 165*58b9f456SAndroid Build Coastguard Worker fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; 166*58b9f456SAndroid Build Coastguard Worker integral fetch_add(integral op, memory_order m = memory_order_seq_cst) noexcept; 167*58b9f456SAndroid Build Coastguard Worker integral 168*58b9f456SAndroid Build Coastguard Worker fetch_sub(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; 169*58b9f456SAndroid Build Coastguard Worker integral fetch_sub(integral op, memory_order m = memory_order_seq_cst) noexcept; 170*58b9f456SAndroid Build Coastguard Worker integral 171*58b9f456SAndroid Build Coastguard Worker fetch_and(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; 172*58b9f456SAndroid Build Coastguard Worker integral fetch_and(integral op, memory_order m = memory_order_seq_cst) noexcept; 173*58b9f456SAndroid Build Coastguard Worker integral 174*58b9f456SAndroid Build Coastguard Worker fetch_or(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; 175*58b9f456SAndroid Build Coastguard Worker integral fetch_or(integral op, memory_order m = memory_order_seq_cst) noexcept; 176*58b9f456SAndroid Build Coastguard Worker integral 177*58b9f456SAndroid Build Coastguard Worker fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile noexcept; 178*58b9f456SAndroid Build Coastguard Worker integral fetch_xor(integral op, memory_order m = memory_order_seq_cst) noexcept; 179*58b9f456SAndroid Build Coastguard Worker 180*58b9f456SAndroid Build Coastguard Worker atomic() noexcept = default; 181*58b9f456SAndroid Build Coastguard Worker constexpr atomic(integral desr) noexcept; 182*58b9f456SAndroid Build Coastguard Worker atomic(const atomic&) = delete; 183*58b9f456SAndroid Build Coastguard Worker atomic& operator=(const atomic&) = delete; 184*58b9f456SAndroid Build Coastguard Worker atomic& operator=(const atomic&) volatile = delete; 185*58b9f456SAndroid Build Coastguard Worker integral operator=(integral desr) volatile noexcept; 186*58b9f456SAndroid Build Coastguard Worker integral operator=(integral desr) noexcept; 187*58b9f456SAndroid Build Coastguard Worker 188*58b9f456SAndroid Build Coastguard Worker integral operator++(int) volatile noexcept; 189*58b9f456SAndroid Build Coastguard Worker integral operator++(int) noexcept; 190*58b9f456SAndroid Build Coastguard Worker integral operator--(int) volatile noexcept; 191*58b9f456SAndroid Build Coastguard Worker integral operator--(int) noexcept; 192*58b9f456SAndroid Build Coastguard Worker integral operator++() volatile noexcept; 193*58b9f456SAndroid Build Coastguard Worker integral operator++() noexcept; 194*58b9f456SAndroid Build Coastguard Worker integral operator--() volatile noexcept; 195*58b9f456SAndroid Build Coastguard Worker integral operator--() noexcept; 196*58b9f456SAndroid Build Coastguard Worker integral operator+=(integral op) volatile noexcept; 197*58b9f456SAndroid Build Coastguard Worker integral operator+=(integral op) noexcept; 198*58b9f456SAndroid Build Coastguard Worker integral operator-=(integral op) volatile noexcept; 199*58b9f456SAndroid Build Coastguard Worker integral operator-=(integral op) noexcept; 200*58b9f456SAndroid Build Coastguard Worker integral operator&=(integral op) volatile noexcept; 201*58b9f456SAndroid Build Coastguard Worker integral operator&=(integral op) noexcept; 202*58b9f456SAndroid Build Coastguard Worker integral operator|=(integral op) volatile noexcept; 203*58b9f456SAndroid Build Coastguard Worker integral operator|=(integral op) noexcept; 204*58b9f456SAndroid Build Coastguard Worker integral operator^=(integral op) volatile noexcept; 205*58b9f456SAndroid Build Coastguard Worker integral operator^=(integral op) noexcept; 206*58b9f456SAndroid Build Coastguard Worker}; 207*58b9f456SAndroid Build Coastguard Worker 208*58b9f456SAndroid Build Coastguard Workertemplate <class T> 209*58b9f456SAndroid Build Coastguard Workerstruct atomic<T*> 210*58b9f456SAndroid Build Coastguard Worker{ 211*58b9f456SAndroid Build Coastguard Worker static constexpr bool is_always_lock_free; 212*58b9f456SAndroid Build Coastguard Worker bool is_lock_free() const volatile noexcept; 213*58b9f456SAndroid Build Coastguard Worker bool is_lock_free() const noexcept; 214*58b9f456SAndroid Build Coastguard Worker void store(T* desr, memory_order m = memory_order_seq_cst) volatile noexcept; 215*58b9f456SAndroid Build Coastguard Worker void store(T* desr, memory_order m = memory_order_seq_cst) noexcept; 216*58b9f456SAndroid Build Coastguard Worker T* load(memory_order m = memory_order_seq_cst) const volatile noexcept; 217*58b9f456SAndroid Build Coastguard Worker T* load(memory_order m = memory_order_seq_cst) const noexcept; 218*58b9f456SAndroid Build Coastguard Worker operator T*() const volatile noexcept; 219*58b9f456SAndroid Build Coastguard Worker operator T*() const noexcept; 220*58b9f456SAndroid Build Coastguard Worker T* exchange(T* desr, memory_order m = memory_order_seq_cst) volatile noexcept; 221*58b9f456SAndroid Build Coastguard Worker T* exchange(T* desr, memory_order m = memory_order_seq_cst) noexcept; 222*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(T*& expc, T* desr, 223*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) volatile noexcept; 224*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(T*& expc, T* desr, 225*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) noexcept; 226*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(T*& expc, T* desr, 227*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) volatile noexcept; 228*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(T*& expc, T* desr, 229*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) noexcept; 230*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(T*& expc, T* desr, 231*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) volatile noexcept; 232*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(T*& expc, T* desr, 233*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) noexcept; 234*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(T*& expc, T* desr, 235*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) volatile noexcept; 236*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(T*& expc, T* desr, 237*58b9f456SAndroid Build Coastguard Worker memory_order m = memory_order_seq_cst) noexcept; 238*58b9f456SAndroid Build Coastguard Worker T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile noexcept; 239*58b9f456SAndroid Build Coastguard Worker T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) noexcept; 240*58b9f456SAndroid Build Coastguard Worker T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile noexcept; 241*58b9f456SAndroid Build Coastguard Worker T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) noexcept; 242*58b9f456SAndroid Build Coastguard Worker 243*58b9f456SAndroid Build Coastguard Worker atomic() noexcept = default; 244*58b9f456SAndroid Build Coastguard Worker constexpr atomic(T* desr) noexcept; 245*58b9f456SAndroid Build Coastguard Worker atomic(const atomic&) = delete; 246*58b9f456SAndroid Build Coastguard Worker atomic& operator=(const atomic&) = delete; 247*58b9f456SAndroid Build Coastguard Worker atomic& operator=(const atomic&) volatile = delete; 248*58b9f456SAndroid Build Coastguard Worker 249*58b9f456SAndroid Build Coastguard Worker T* operator=(T*) volatile noexcept; 250*58b9f456SAndroid Build Coastguard Worker T* operator=(T*) noexcept; 251*58b9f456SAndroid Build Coastguard Worker T* operator++(int) volatile noexcept; 252*58b9f456SAndroid Build Coastguard Worker T* operator++(int) noexcept; 253*58b9f456SAndroid Build Coastguard Worker T* operator--(int) volatile noexcept; 254*58b9f456SAndroid Build Coastguard Worker T* operator--(int) noexcept; 255*58b9f456SAndroid Build Coastguard Worker T* operator++() volatile noexcept; 256*58b9f456SAndroid Build Coastguard Worker T* operator++() noexcept; 257*58b9f456SAndroid Build Coastguard Worker T* operator--() volatile noexcept; 258*58b9f456SAndroid Build Coastguard Worker T* operator--() noexcept; 259*58b9f456SAndroid Build Coastguard Worker T* operator+=(ptrdiff_t op) volatile noexcept; 260*58b9f456SAndroid Build Coastguard Worker T* operator+=(ptrdiff_t op) noexcept; 261*58b9f456SAndroid Build Coastguard Worker T* operator-=(ptrdiff_t op) volatile noexcept; 262*58b9f456SAndroid Build Coastguard Worker T* operator-=(ptrdiff_t op) noexcept; 263*58b9f456SAndroid Build Coastguard Worker}; 264*58b9f456SAndroid Build Coastguard Worker 265*58b9f456SAndroid Build Coastguard Worker 266*58b9f456SAndroid Build Coastguard Workertemplate <class T> 267*58b9f456SAndroid Build Coastguard Worker bool 268*58b9f456SAndroid Build Coastguard Worker atomic_is_lock_free(const volatile atomic<T>* obj) noexcept; 269*58b9f456SAndroid Build Coastguard Worker 270*58b9f456SAndroid Build Coastguard Workertemplate <class T> 271*58b9f456SAndroid Build Coastguard Worker bool 272*58b9f456SAndroid Build Coastguard Worker atomic_is_lock_free(const atomic<T>* obj) noexcept; 273*58b9f456SAndroid Build Coastguard Worker 274*58b9f456SAndroid Build Coastguard Workertemplate <class T> 275*58b9f456SAndroid Build Coastguard Worker void 276*58b9f456SAndroid Build Coastguard Worker atomic_init(volatile atomic<T>* obj, T desr) noexcept; 277*58b9f456SAndroid Build Coastguard Worker 278*58b9f456SAndroid Build Coastguard Workertemplate <class T> 279*58b9f456SAndroid Build Coastguard Worker void 280*58b9f456SAndroid Build Coastguard Worker atomic_init(atomic<T>* obj, T desr) noexcept; 281*58b9f456SAndroid Build Coastguard Worker 282*58b9f456SAndroid Build Coastguard Workertemplate <class T> 283*58b9f456SAndroid Build Coastguard Worker void 284*58b9f456SAndroid Build Coastguard Worker atomic_store(volatile atomic<T>* obj, T desr) noexcept; 285*58b9f456SAndroid Build Coastguard Worker 286*58b9f456SAndroid Build Coastguard Workertemplate <class T> 287*58b9f456SAndroid Build Coastguard Worker void 288*58b9f456SAndroid Build Coastguard Worker atomic_store(atomic<T>* obj, T desr) noexcept; 289*58b9f456SAndroid Build Coastguard Worker 290*58b9f456SAndroid Build Coastguard Workertemplate <class T> 291*58b9f456SAndroid Build Coastguard Worker void 292*58b9f456SAndroid Build Coastguard Worker atomic_store_explicit(volatile atomic<T>* obj, T desr, memory_order m) noexcept; 293*58b9f456SAndroid Build Coastguard Worker 294*58b9f456SAndroid Build Coastguard Workertemplate <class T> 295*58b9f456SAndroid Build Coastguard Worker void 296*58b9f456SAndroid Build Coastguard Worker atomic_store_explicit(atomic<T>* obj, T desr, memory_order m) noexcept; 297*58b9f456SAndroid Build Coastguard Worker 298*58b9f456SAndroid Build Coastguard Workertemplate <class T> 299*58b9f456SAndroid Build Coastguard Worker T 300*58b9f456SAndroid Build Coastguard Worker atomic_load(const volatile atomic<T>* obj) noexcept; 301*58b9f456SAndroid Build Coastguard Worker 302*58b9f456SAndroid Build Coastguard Workertemplate <class T> 303*58b9f456SAndroid Build Coastguard Worker T 304*58b9f456SAndroid Build Coastguard Worker atomic_load(const atomic<T>* obj) noexcept; 305*58b9f456SAndroid Build Coastguard Worker 306*58b9f456SAndroid Build Coastguard Workertemplate <class T> 307*58b9f456SAndroid Build Coastguard Worker T 308*58b9f456SAndroid Build Coastguard Worker atomic_load_explicit(const volatile atomic<T>* obj, memory_order m) noexcept; 309*58b9f456SAndroid Build Coastguard Worker 310*58b9f456SAndroid Build Coastguard Workertemplate <class T> 311*58b9f456SAndroid Build Coastguard Worker T 312*58b9f456SAndroid Build Coastguard Worker atomic_load_explicit(const atomic<T>* obj, memory_order m) noexcept; 313*58b9f456SAndroid Build Coastguard Worker 314*58b9f456SAndroid Build Coastguard Workertemplate <class T> 315*58b9f456SAndroid Build Coastguard Worker T 316*58b9f456SAndroid Build Coastguard Worker atomic_exchange(volatile atomic<T>* obj, T desr) noexcept; 317*58b9f456SAndroid Build Coastguard Worker 318*58b9f456SAndroid Build Coastguard Workertemplate <class T> 319*58b9f456SAndroid Build Coastguard Worker T 320*58b9f456SAndroid Build Coastguard Worker atomic_exchange(atomic<T>* obj, T desr) noexcept; 321*58b9f456SAndroid Build Coastguard Worker 322*58b9f456SAndroid Build Coastguard Workertemplate <class T> 323*58b9f456SAndroid Build Coastguard Worker T 324*58b9f456SAndroid Build Coastguard Worker atomic_exchange_explicit(volatile atomic<T>* obj, T desr, memory_order m) noexcept; 325*58b9f456SAndroid Build Coastguard Worker 326*58b9f456SAndroid Build Coastguard Workertemplate <class T> 327*58b9f456SAndroid Build Coastguard Worker T 328*58b9f456SAndroid Build Coastguard Worker atomic_exchange_explicit(atomic<T>* obj, T desr, memory_order m) noexcept; 329*58b9f456SAndroid Build Coastguard Worker 330*58b9f456SAndroid Build Coastguard Workertemplate <class T> 331*58b9f456SAndroid Build Coastguard Worker bool 332*58b9f456SAndroid Build Coastguard Worker atomic_compare_exchange_weak(volatile atomic<T>* obj, T* expc, T desr) noexcept; 333*58b9f456SAndroid Build Coastguard Worker 334*58b9f456SAndroid Build Coastguard Workertemplate <class T> 335*58b9f456SAndroid Build Coastguard Worker bool 336*58b9f456SAndroid Build Coastguard Worker atomic_compare_exchange_weak(atomic<T>* obj, T* expc, T desr) noexcept; 337*58b9f456SAndroid Build Coastguard Worker 338*58b9f456SAndroid Build Coastguard Workertemplate <class T> 339*58b9f456SAndroid Build Coastguard Worker bool 340*58b9f456SAndroid Build Coastguard Worker atomic_compare_exchange_strong(volatile atomic<T>* obj, T* expc, T desr) noexcept; 341*58b9f456SAndroid Build Coastguard Worker 342*58b9f456SAndroid Build Coastguard Workertemplate <class T> 343*58b9f456SAndroid Build Coastguard Worker bool 344*58b9f456SAndroid Build Coastguard Worker atomic_compare_exchange_strong(atomic<T>* obj, T* expc, T desr) noexcept; 345*58b9f456SAndroid Build Coastguard Worker 346*58b9f456SAndroid Build Coastguard Workertemplate <class T> 347*58b9f456SAndroid Build Coastguard Worker bool 348*58b9f456SAndroid Build Coastguard Worker atomic_compare_exchange_weak_explicit(volatile atomic<T>* obj, T* expc, 349*58b9f456SAndroid Build Coastguard Worker T desr, 350*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) noexcept; 351*58b9f456SAndroid Build Coastguard Worker 352*58b9f456SAndroid Build Coastguard Workertemplate <class T> 353*58b9f456SAndroid Build Coastguard Worker bool 354*58b9f456SAndroid Build Coastguard Worker atomic_compare_exchange_weak_explicit(atomic<T>* obj, T* expc, T desr, 355*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) noexcept; 356*58b9f456SAndroid Build Coastguard Worker 357*58b9f456SAndroid Build Coastguard Workertemplate <class T> 358*58b9f456SAndroid Build Coastguard Worker bool 359*58b9f456SAndroid Build Coastguard Worker atomic_compare_exchange_strong_explicit(volatile atomic<T>* obj, 360*58b9f456SAndroid Build Coastguard Worker T* expc, T desr, 361*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) noexcept; 362*58b9f456SAndroid Build Coastguard Worker 363*58b9f456SAndroid Build Coastguard Workertemplate <class T> 364*58b9f456SAndroid Build Coastguard Worker bool 365*58b9f456SAndroid Build Coastguard Worker atomic_compare_exchange_strong_explicit(atomic<T>* obj, T* expc, 366*58b9f456SAndroid Build Coastguard Worker T desr, 367*58b9f456SAndroid Build Coastguard Worker memory_order s, memory_order f) noexcept; 368*58b9f456SAndroid Build Coastguard Worker 369*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 370*58b9f456SAndroid Build Coastguard Worker Integral 371*58b9f456SAndroid Build Coastguard Worker atomic_fetch_add(volatile atomic<Integral>* obj, Integral op) noexcept; 372*58b9f456SAndroid Build Coastguard Worker 373*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 374*58b9f456SAndroid Build Coastguard Worker Integral 375*58b9f456SAndroid Build Coastguard Worker atomic_fetch_add(atomic<Integral>* obj, Integral op) noexcept; 376*58b9f456SAndroid Build Coastguard Worker 377*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 378*58b9f456SAndroid Build Coastguard Worker Integral 379*58b9f456SAndroid Build Coastguard Worker atomic_fetch_add_explicit(volatile atomic<Integral>* obj, Integral op, 380*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 381*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 382*58b9f456SAndroid Build Coastguard Worker Integral 383*58b9f456SAndroid Build Coastguard Worker atomic_fetch_add_explicit(atomic<Integral>* obj, Integral op, 384*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 385*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 386*58b9f456SAndroid Build Coastguard Worker Integral 387*58b9f456SAndroid Build Coastguard Worker atomic_fetch_sub(volatile atomic<Integral>* obj, Integral op) noexcept; 388*58b9f456SAndroid Build Coastguard Worker 389*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 390*58b9f456SAndroid Build Coastguard Worker Integral 391*58b9f456SAndroid Build Coastguard Worker atomic_fetch_sub(atomic<Integral>* obj, Integral op) noexcept; 392*58b9f456SAndroid Build Coastguard Worker 393*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 394*58b9f456SAndroid Build Coastguard Worker Integral 395*58b9f456SAndroid Build Coastguard Worker atomic_fetch_sub_explicit(volatile atomic<Integral>* obj, Integral op, 396*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 397*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 398*58b9f456SAndroid Build Coastguard Worker Integral 399*58b9f456SAndroid Build Coastguard Worker atomic_fetch_sub_explicit(atomic<Integral>* obj, Integral op, 400*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 401*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 402*58b9f456SAndroid Build Coastguard Worker Integral 403*58b9f456SAndroid Build Coastguard Worker atomic_fetch_and(volatile atomic<Integral>* obj, Integral op) noexcept; 404*58b9f456SAndroid Build Coastguard Worker 405*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 406*58b9f456SAndroid Build Coastguard Worker Integral 407*58b9f456SAndroid Build Coastguard Worker atomic_fetch_and(atomic<Integral>* obj, Integral op) noexcept; 408*58b9f456SAndroid Build Coastguard Worker 409*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 410*58b9f456SAndroid Build Coastguard Worker Integral 411*58b9f456SAndroid Build Coastguard Worker atomic_fetch_and_explicit(volatile atomic<Integral>* obj, Integral op, 412*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 413*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 414*58b9f456SAndroid Build Coastguard Worker Integral 415*58b9f456SAndroid Build Coastguard Worker atomic_fetch_and_explicit(atomic<Integral>* obj, Integral op, 416*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 417*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 418*58b9f456SAndroid Build Coastguard Worker Integral 419*58b9f456SAndroid Build Coastguard Worker atomic_fetch_or(volatile atomic<Integral>* obj, Integral op) noexcept; 420*58b9f456SAndroid Build Coastguard Worker 421*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 422*58b9f456SAndroid Build Coastguard Worker Integral 423*58b9f456SAndroid Build Coastguard Worker atomic_fetch_or(atomic<Integral>* obj, Integral op) noexcept; 424*58b9f456SAndroid Build Coastguard Worker 425*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 426*58b9f456SAndroid Build Coastguard Worker Integral 427*58b9f456SAndroid Build Coastguard Worker atomic_fetch_or_explicit(volatile atomic<Integral>* obj, Integral op, 428*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 429*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 430*58b9f456SAndroid Build Coastguard Worker Integral 431*58b9f456SAndroid Build Coastguard Worker atomic_fetch_or_explicit(atomic<Integral>* obj, Integral op, 432*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 433*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 434*58b9f456SAndroid Build Coastguard Worker Integral 435*58b9f456SAndroid Build Coastguard Worker atomic_fetch_xor(volatile atomic<Integral>* obj, Integral op) noexcept; 436*58b9f456SAndroid Build Coastguard Worker 437*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 438*58b9f456SAndroid Build Coastguard Worker Integral 439*58b9f456SAndroid Build Coastguard Worker atomic_fetch_xor(atomic<Integral>* obj, Integral op) noexcept; 440*58b9f456SAndroid Build Coastguard Worker 441*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 442*58b9f456SAndroid Build Coastguard Worker Integral 443*58b9f456SAndroid Build Coastguard Worker atomic_fetch_xor_explicit(volatile atomic<Integral>* obj, Integral op, 444*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 445*58b9f456SAndroid Build Coastguard Workertemplate <class Integral> 446*58b9f456SAndroid Build Coastguard Worker Integral 447*58b9f456SAndroid Build Coastguard Worker atomic_fetch_xor_explicit(atomic<Integral>* obj, Integral op, 448*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 449*58b9f456SAndroid Build Coastguard Worker 450*58b9f456SAndroid Build Coastguard Workertemplate <class T> 451*58b9f456SAndroid Build Coastguard Worker T* 452*58b9f456SAndroid Build Coastguard Worker atomic_fetch_add(volatile atomic<T*>* obj, ptrdiff_t op) noexcept; 453*58b9f456SAndroid Build Coastguard Worker 454*58b9f456SAndroid Build Coastguard Workertemplate <class T> 455*58b9f456SAndroid Build Coastguard Worker T* 456*58b9f456SAndroid Build Coastguard Worker atomic_fetch_add(atomic<T*>* obj, ptrdiff_t op) noexcept; 457*58b9f456SAndroid Build Coastguard Worker 458*58b9f456SAndroid Build Coastguard Workertemplate <class T> 459*58b9f456SAndroid Build Coastguard Worker T* 460*58b9f456SAndroid Build Coastguard Worker atomic_fetch_add_explicit(volatile atomic<T*>* obj, ptrdiff_t op, 461*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 462*58b9f456SAndroid Build Coastguard Workertemplate <class T> 463*58b9f456SAndroid Build Coastguard Worker T* 464*58b9f456SAndroid Build Coastguard Worker atomic_fetch_add_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m) noexcept; 465*58b9f456SAndroid Build Coastguard Worker 466*58b9f456SAndroid Build Coastguard Workertemplate <class T> 467*58b9f456SAndroid Build Coastguard Worker T* 468*58b9f456SAndroid Build Coastguard Worker atomic_fetch_sub(volatile atomic<T*>* obj, ptrdiff_t op) noexcept; 469*58b9f456SAndroid Build Coastguard Worker 470*58b9f456SAndroid Build Coastguard Workertemplate <class T> 471*58b9f456SAndroid Build Coastguard Worker T* 472*58b9f456SAndroid Build Coastguard Worker atomic_fetch_sub(atomic<T*>* obj, ptrdiff_t op) noexcept; 473*58b9f456SAndroid Build Coastguard Worker 474*58b9f456SAndroid Build Coastguard Workertemplate <class T> 475*58b9f456SAndroid Build Coastguard Worker T* 476*58b9f456SAndroid Build Coastguard Worker atomic_fetch_sub_explicit(volatile atomic<T*>* obj, ptrdiff_t op, 477*58b9f456SAndroid Build Coastguard Worker memory_order m) noexcept; 478*58b9f456SAndroid Build Coastguard Workertemplate <class T> 479*58b9f456SAndroid Build Coastguard Worker T* 480*58b9f456SAndroid Build Coastguard Worker atomic_fetch_sub_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m) noexcept; 481*58b9f456SAndroid Build Coastguard Worker 482*58b9f456SAndroid Build Coastguard Worker// Atomics for standard typedef types 483*58b9f456SAndroid Build Coastguard Worker 484*58b9f456SAndroid Build Coastguard Workertypedef atomic<bool> atomic_bool; 485*58b9f456SAndroid Build Coastguard Workertypedef atomic<char> atomic_char; 486*58b9f456SAndroid Build Coastguard Workertypedef atomic<signed char> atomic_schar; 487*58b9f456SAndroid Build Coastguard Workertypedef atomic<unsigned char> atomic_uchar; 488*58b9f456SAndroid Build Coastguard Workertypedef atomic<short> atomic_short; 489*58b9f456SAndroid Build Coastguard Workertypedef atomic<unsigned short> atomic_ushort; 490*58b9f456SAndroid Build Coastguard Workertypedef atomic<int> atomic_int; 491*58b9f456SAndroid Build Coastguard Workertypedef atomic<unsigned int> atomic_uint; 492*58b9f456SAndroid Build Coastguard Workertypedef atomic<long> atomic_long; 493*58b9f456SAndroid Build Coastguard Workertypedef atomic<unsigned long> atomic_ulong; 494*58b9f456SAndroid Build Coastguard Workertypedef atomic<long long> atomic_llong; 495*58b9f456SAndroid Build Coastguard Workertypedef atomic<unsigned long long> atomic_ullong; 496*58b9f456SAndroid Build Coastguard Workertypedef atomic<char16_t> atomic_char16_t; 497*58b9f456SAndroid Build Coastguard Workertypedef atomic<char32_t> atomic_char32_t; 498*58b9f456SAndroid Build Coastguard Workertypedef atomic<wchar_t> atomic_wchar_t; 499*58b9f456SAndroid Build Coastguard Worker 500*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_least8_t> atomic_int_least8_t; 501*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_least8_t> atomic_uint_least8_t; 502*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_least16_t> atomic_int_least16_t; 503*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_least16_t> atomic_uint_least16_t; 504*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_least32_t> atomic_int_least32_t; 505*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_least32_t> atomic_uint_least32_t; 506*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_least64_t> atomic_int_least64_t; 507*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_least64_t> atomic_uint_least64_t; 508*58b9f456SAndroid Build Coastguard Worker 509*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_fast8_t> atomic_int_fast8_t; 510*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_fast8_t> atomic_uint_fast8_t; 511*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_fast16_t> atomic_int_fast16_t; 512*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_fast16_t> atomic_uint_fast16_t; 513*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_fast32_t> atomic_int_fast32_t; 514*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_fast32_t> atomic_uint_fast32_t; 515*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_fast64_t> atomic_int_fast64_t; 516*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_fast64_t> atomic_uint_fast64_t; 517*58b9f456SAndroid Build Coastguard Worker 518*58b9f456SAndroid Build Coastguard Workertypedef atomic<int8_t> atomic_int8_t; 519*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint8_t> atomic_uint8_t; 520*58b9f456SAndroid Build Coastguard Workertypedef atomic<int16_t> atomic_int16_t; 521*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint16_t> atomic_uint16_t; 522*58b9f456SAndroid Build Coastguard Workertypedef atomic<int32_t> atomic_int32_t; 523*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint32_t> atomic_uint32_t; 524*58b9f456SAndroid Build Coastguard Workertypedef atomic<int64_t> atomic_int64_t; 525*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint64_t> atomic_uint64_t; 526*58b9f456SAndroid Build Coastguard Worker 527*58b9f456SAndroid Build Coastguard Workertypedef atomic<intptr_t> atomic_intptr_t; 528*58b9f456SAndroid Build Coastguard Workertypedef atomic<uintptr_t> atomic_uintptr_t; 529*58b9f456SAndroid Build Coastguard Workertypedef atomic<size_t> atomic_size_t; 530*58b9f456SAndroid Build Coastguard Workertypedef atomic<ptrdiff_t> atomic_ptrdiff_t; 531*58b9f456SAndroid Build Coastguard Workertypedef atomic<intmax_t> atomic_intmax_t; 532*58b9f456SAndroid Build Coastguard Workertypedef atomic<uintmax_t> atomic_uintmax_t; 533*58b9f456SAndroid Build Coastguard Worker 534*58b9f456SAndroid Build Coastguard Worker// fences 535*58b9f456SAndroid Build Coastguard Worker 536*58b9f456SAndroid Build Coastguard Workervoid atomic_thread_fence(memory_order m) noexcept; 537*58b9f456SAndroid Build Coastguard Workervoid atomic_signal_fence(memory_order m) noexcept; 538*58b9f456SAndroid Build Coastguard Worker 539*58b9f456SAndroid Build Coastguard Worker} // std 540*58b9f456SAndroid Build Coastguard Worker 541*58b9f456SAndroid Build Coastguard Worker*/ 542*58b9f456SAndroid Build Coastguard Worker 543*58b9f456SAndroid Build Coastguard Worker#include <__config> 544*58b9f456SAndroid Build Coastguard Worker#include <cstddef> 545*58b9f456SAndroid Build Coastguard Worker#include <cstdint> 546*58b9f456SAndroid Build Coastguard Worker#include <type_traits> 547*58b9f456SAndroid Build Coastguard Worker#include <version> 548*58b9f456SAndroid Build Coastguard Worker 549*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 550*58b9f456SAndroid Build Coastguard Worker#pragma GCC system_header 551*58b9f456SAndroid Build Coastguard Worker#endif 552*58b9f456SAndroid Build Coastguard Worker 553*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_HAS_NO_THREADS 554*58b9f456SAndroid Build Coastguard Worker#error <atomic> is not supported on this single threaded system 555*58b9f456SAndroid Build Coastguard Worker#endif 556*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) 557*58b9f456SAndroid Build Coastguard Worker#error <atomic> is not implemented 558*58b9f456SAndroid Build Coastguard Worker#endif 559*58b9f456SAndroid Build Coastguard Worker#ifdef kill_dependency 560*58b9f456SAndroid Build Coastguard Worker#error C++ standard library is incompatible with <stdatomic.h> 561*58b9f456SAndroid Build Coastguard Worker#endif 562*58b9f456SAndroid Build Coastguard Worker 563*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \ 564*58b9f456SAndroid Build Coastguard Worker _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \ 565*58b9f456SAndroid Build Coastguard Worker __m == memory_order_acquire || \ 566*58b9f456SAndroid Build Coastguard Worker __m == memory_order_acq_rel, \ 567*58b9f456SAndroid Build Coastguard Worker "memory order argument to atomic operation is invalid") 568*58b9f456SAndroid Build Coastguard Worker 569*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \ 570*58b9f456SAndroid Build Coastguard Worker _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || \ 571*58b9f456SAndroid Build Coastguard Worker __m == memory_order_acq_rel, \ 572*58b9f456SAndroid Build Coastguard Worker "memory order argument to atomic operation is invalid") 573*58b9f456SAndroid Build Coastguard Worker 574*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \ 575*58b9f456SAndroid Build Coastguard Worker _LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || \ 576*58b9f456SAndroid Build Coastguard Worker __f == memory_order_acq_rel, \ 577*58b9f456SAndroid Build Coastguard Worker "memory order argument to atomic operation is invalid") 578*58b9f456SAndroid Build Coastguard Worker 579*58b9f456SAndroid Build Coastguard Worker_LIBCPP_BEGIN_NAMESPACE_STD 580*58b9f456SAndroid Build Coastguard Worker 581*58b9f456SAndroid Build Coastguard Workertypedef enum memory_order 582*58b9f456SAndroid Build Coastguard Worker{ 583*58b9f456SAndroid Build Coastguard Worker memory_order_relaxed, memory_order_consume, memory_order_acquire, 584*58b9f456SAndroid Build Coastguard Worker memory_order_release, memory_order_acq_rel, memory_order_seq_cst 585*58b9f456SAndroid Build Coastguard Worker} memory_order; 586*58b9f456SAndroid Build Coastguard Worker 587*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) 588*58b9f456SAndroid Build Coastguard Workernamespace __gcc_atomic { 589*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 590*58b9f456SAndroid Build Coastguard Workerstruct __gcc_atomic_t { 591*58b9f456SAndroid Build Coastguard Worker 592*58b9f456SAndroid Build Coastguard Worker#if _GNUC_VER >= 501 593*58b9f456SAndroid Build Coastguard Worker static_assert(is_trivially_copyable<_Tp>::value, 594*58b9f456SAndroid Build Coastguard Worker "std::atomic<Tp> requires that 'Tp' be a trivially copyable type"); 595*58b9f456SAndroid Build Coastguard Worker#endif 596*58b9f456SAndroid Build Coastguard Worker 597*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 598*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 599*58b9f456SAndroid Build Coastguard Worker __gcc_atomic_t() _NOEXCEPT = default; 600*58b9f456SAndroid Build Coastguard Worker#else 601*58b9f456SAndroid Build Coastguard Worker __gcc_atomic_t() _NOEXCEPT : __a_value() {} 602*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 603*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CONSTEXPR explicit __gcc_atomic_t(_Tp value) _NOEXCEPT 604*58b9f456SAndroid Build Coastguard Worker : __a_value(value) {} 605*58b9f456SAndroid Build Coastguard Worker _Tp __a_value; 606*58b9f456SAndroid Build Coastguard Worker}; 607*58b9f456SAndroid Build Coastguard Worker#define _Atomic(x) __gcc_atomic::__gcc_atomic_t<x> 608*58b9f456SAndroid Build Coastguard Worker 609*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> _Tp __create(); 610*58b9f456SAndroid Build Coastguard Worker 611*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp, typename _Td> 612*58b9f456SAndroid Build Coastguard Workertypename enable_if<sizeof(_Tp()->__a_value = __create<_Td>()), char>::type 613*58b9f456SAndroid Build Coastguard Worker __test_atomic_assignable(int); 614*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp, typename _Up> 615*58b9f456SAndroid Build Coastguard Worker__two __test_atomic_assignable(...); 616*58b9f456SAndroid Build Coastguard Worker 617*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp, typename _Td> 618*58b9f456SAndroid Build Coastguard Workerstruct __can_assign { 619*58b9f456SAndroid Build Coastguard Worker static const bool value = 620*58b9f456SAndroid Build Coastguard Worker sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char); 621*58b9f456SAndroid Build Coastguard Worker}; 622*58b9f456SAndroid Build Coastguard Worker 623*58b9f456SAndroid Build Coastguard Workerstatic inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) { 624*58b9f456SAndroid Build Coastguard Worker // Avoid switch statement to make this a constexpr. 625*58b9f456SAndroid Build Coastguard Worker return __order == memory_order_relaxed ? __ATOMIC_RELAXED: 626*58b9f456SAndroid Build Coastguard Worker (__order == memory_order_acquire ? __ATOMIC_ACQUIRE: 627*58b9f456SAndroid Build Coastguard Worker (__order == memory_order_release ? __ATOMIC_RELEASE: 628*58b9f456SAndroid Build Coastguard Worker (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST: 629*58b9f456SAndroid Build Coastguard Worker (__order == memory_order_acq_rel ? __ATOMIC_ACQ_REL: 630*58b9f456SAndroid Build Coastguard Worker __ATOMIC_CONSUME)))); 631*58b9f456SAndroid Build Coastguard Worker} 632*58b9f456SAndroid Build Coastguard Worker 633*58b9f456SAndroid Build Coastguard Workerstatic inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) { 634*58b9f456SAndroid Build Coastguard Worker // Avoid switch statement to make this a constexpr. 635*58b9f456SAndroid Build Coastguard Worker return __order == memory_order_relaxed ? __ATOMIC_RELAXED: 636*58b9f456SAndroid Build Coastguard Worker (__order == memory_order_acquire ? __ATOMIC_ACQUIRE: 637*58b9f456SAndroid Build Coastguard Worker (__order == memory_order_release ? __ATOMIC_RELAXED: 638*58b9f456SAndroid Build Coastguard Worker (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST: 639*58b9f456SAndroid Build Coastguard Worker (__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE: 640*58b9f456SAndroid Build Coastguard Worker __ATOMIC_CONSUME)))); 641*58b9f456SAndroid Build Coastguard Worker} 642*58b9f456SAndroid Build Coastguard Worker 643*58b9f456SAndroid Build Coastguard Worker} // namespace __gcc_atomic 644*58b9f456SAndroid Build Coastguard Worker 645*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 646*58b9f456SAndroid Build Coastguard Workerstatic inline 647*58b9f456SAndroid Build Coastguard Workertypename enable_if< 648*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value>::type 649*58b9f456SAndroid Build Coastguard Worker__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) { 650*58b9f456SAndroid Build Coastguard Worker __a->__a_value = __val; 651*58b9f456SAndroid Build Coastguard Worker} 652*58b9f456SAndroid Build Coastguard Worker 653*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 654*58b9f456SAndroid Build Coastguard Workerstatic inline 655*58b9f456SAndroid Build Coastguard Workertypename enable_if< 656*58b9f456SAndroid Build Coastguard Worker !__gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value && 657*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__can_assign< _Atomic(_Tp)*, _Tp>::value>::type 658*58b9f456SAndroid Build Coastguard Worker__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) { 659*58b9f456SAndroid Build Coastguard Worker // [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because 660*58b9f456SAndroid Build Coastguard Worker // the default operator= in an object is not volatile, a byte-by-byte copy 661*58b9f456SAndroid Build Coastguard Worker // is required. 662*58b9f456SAndroid Build Coastguard Worker volatile char* to = reinterpret_cast<volatile char*>(&__a->__a_value); 663*58b9f456SAndroid Build Coastguard Worker volatile char* end = to + sizeof(_Tp); 664*58b9f456SAndroid Build Coastguard Worker char* from = reinterpret_cast<char*>(&__val); 665*58b9f456SAndroid Build Coastguard Worker while (to != end) { 666*58b9f456SAndroid Build Coastguard Worker *to++ = *from++; 667*58b9f456SAndroid Build Coastguard Worker } 668*58b9f456SAndroid Build Coastguard Worker} 669*58b9f456SAndroid Build Coastguard Worker 670*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 671*58b9f456SAndroid Build Coastguard Workerstatic inline void __c11_atomic_init(_Atomic(_Tp)* __a, _Tp __val) { 672*58b9f456SAndroid Build Coastguard Worker __a->__a_value = __val; 673*58b9f456SAndroid Build Coastguard Worker} 674*58b9f456SAndroid Build Coastguard Worker 675*58b9f456SAndroid Build Coastguard Workerstatic inline void __c11_atomic_thread_fence(memory_order __order) { 676*58b9f456SAndroid Build Coastguard Worker __atomic_thread_fence(__gcc_atomic::__to_gcc_order(__order)); 677*58b9f456SAndroid Build Coastguard Worker} 678*58b9f456SAndroid Build Coastguard Worker 679*58b9f456SAndroid Build Coastguard Workerstatic inline void __c11_atomic_signal_fence(memory_order __order) { 680*58b9f456SAndroid Build Coastguard Worker __atomic_signal_fence(__gcc_atomic::__to_gcc_order(__order)); 681*58b9f456SAndroid Build Coastguard Worker} 682*58b9f456SAndroid Build Coastguard Worker 683*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 684*58b9f456SAndroid Build Coastguard Workerstatic inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a, _Tp __val, 685*58b9f456SAndroid Build Coastguard Worker memory_order __order) { 686*58b9f456SAndroid Build Coastguard Worker return __atomic_store(&__a->__a_value, &__val, 687*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 688*58b9f456SAndroid Build Coastguard Worker} 689*58b9f456SAndroid Build Coastguard Worker 690*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 691*58b9f456SAndroid Build Coastguard Workerstatic inline void __c11_atomic_store(_Atomic(_Tp)* __a, _Tp __val, 692*58b9f456SAndroid Build Coastguard Worker memory_order __order) { 693*58b9f456SAndroid Build Coastguard Worker __atomic_store(&__a->__a_value, &__val, 694*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 695*58b9f456SAndroid Build Coastguard Worker} 696*58b9f456SAndroid Build Coastguard Worker 697*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 698*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_load(const volatile _Atomic(_Tp)* __a, 699*58b9f456SAndroid Build Coastguard Worker memory_order __order) { 700*58b9f456SAndroid Build Coastguard Worker _Tp __ret; 701*58b9f456SAndroid Build Coastguard Worker __atomic_load(&__a->__a_value, &__ret, 702*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 703*58b9f456SAndroid Build Coastguard Worker return __ret; 704*58b9f456SAndroid Build Coastguard Worker} 705*58b9f456SAndroid Build Coastguard Worker 706*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 707*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_load(const _Atomic(_Tp)* __a, memory_order __order) { 708*58b9f456SAndroid Build Coastguard Worker _Tp __ret; 709*58b9f456SAndroid Build Coastguard Worker __atomic_load(&__a->__a_value, &__ret, 710*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 711*58b9f456SAndroid Build Coastguard Worker return __ret; 712*58b9f456SAndroid Build Coastguard Worker} 713*58b9f456SAndroid Build Coastguard Worker 714*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 715*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_exchange(volatile _Atomic(_Tp)* __a, 716*58b9f456SAndroid Build Coastguard Worker _Tp __value, memory_order __order) { 717*58b9f456SAndroid Build Coastguard Worker _Tp __ret; 718*58b9f456SAndroid Build Coastguard Worker __atomic_exchange(&__a->__a_value, &__value, &__ret, 719*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 720*58b9f456SAndroid Build Coastguard Worker return __ret; 721*58b9f456SAndroid Build Coastguard Worker} 722*58b9f456SAndroid Build Coastguard Worker 723*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 724*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_exchange(_Atomic(_Tp)* __a, _Tp __value, 725*58b9f456SAndroid Build Coastguard Worker memory_order __order) { 726*58b9f456SAndroid Build Coastguard Worker _Tp __ret; 727*58b9f456SAndroid Build Coastguard Worker __atomic_exchange(&__a->__a_value, &__value, &__ret, 728*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 729*58b9f456SAndroid Build Coastguard Worker return __ret; 730*58b9f456SAndroid Build Coastguard Worker} 731*58b9f456SAndroid Build Coastguard Worker 732*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 733*58b9f456SAndroid Build Coastguard Workerstatic inline bool __c11_atomic_compare_exchange_strong( 734*58b9f456SAndroid Build Coastguard Worker volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, 735*58b9f456SAndroid Build Coastguard Worker memory_order __success, memory_order __failure) { 736*58b9f456SAndroid Build Coastguard Worker return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, 737*58b9f456SAndroid Build Coastguard Worker false, 738*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__success), 739*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_failure_order(__failure)); 740*58b9f456SAndroid Build Coastguard Worker} 741*58b9f456SAndroid Build Coastguard Worker 742*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 743*58b9f456SAndroid Build Coastguard Workerstatic inline bool __c11_atomic_compare_exchange_strong( 744*58b9f456SAndroid Build Coastguard Worker _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success, 745*58b9f456SAndroid Build Coastguard Worker memory_order __failure) { 746*58b9f456SAndroid Build Coastguard Worker return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, 747*58b9f456SAndroid Build Coastguard Worker false, 748*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__success), 749*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_failure_order(__failure)); 750*58b9f456SAndroid Build Coastguard Worker} 751*58b9f456SAndroid Build Coastguard Worker 752*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 753*58b9f456SAndroid Build Coastguard Workerstatic inline bool __c11_atomic_compare_exchange_weak( 754*58b9f456SAndroid Build Coastguard Worker volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, 755*58b9f456SAndroid Build Coastguard Worker memory_order __success, memory_order __failure) { 756*58b9f456SAndroid Build Coastguard Worker return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, 757*58b9f456SAndroid Build Coastguard Worker true, 758*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__success), 759*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_failure_order(__failure)); 760*58b9f456SAndroid Build Coastguard Worker} 761*58b9f456SAndroid Build Coastguard Worker 762*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 763*58b9f456SAndroid Build Coastguard Workerstatic inline bool __c11_atomic_compare_exchange_weak( 764*58b9f456SAndroid Build Coastguard Worker _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success, 765*58b9f456SAndroid Build Coastguard Worker memory_order __failure) { 766*58b9f456SAndroid Build Coastguard Worker return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, 767*58b9f456SAndroid Build Coastguard Worker true, 768*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__success), 769*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_failure_order(__failure)); 770*58b9f456SAndroid Build Coastguard Worker} 771*58b9f456SAndroid Build Coastguard Worker 772*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 773*58b9f456SAndroid Build Coastguard Workerstruct __skip_amt { enum {value = 1}; }; 774*58b9f456SAndroid Build Coastguard Worker 775*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 776*58b9f456SAndroid Build Coastguard Workerstruct __skip_amt<_Tp*> { enum {value = sizeof(_Tp)}; }; 777*58b9f456SAndroid Build Coastguard Worker 778*58b9f456SAndroid Build Coastguard Worker// FIXME: Haven't figured out what the spec says about using arrays with 779*58b9f456SAndroid Build Coastguard Worker// atomic_fetch_add. Force a failure rather than creating bad behavior. 780*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 781*58b9f456SAndroid Build Coastguard Workerstruct __skip_amt<_Tp[]> { }; 782*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp, int n> 783*58b9f456SAndroid Build Coastguard Workerstruct __skip_amt<_Tp[n]> { }; 784*58b9f456SAndroid Build Coastguard Worker 785*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp, typename _Td> 786*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_fetch_add(volatile _Atomic(_Tp)* __a, 787*58b9f456SAndroid Build Coastguard Worker _Td __delta, memory_order __order) { 788*58b9f456SAndroid Build Coastguard Worker return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value, 789*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 790*58b9f456SAndroid Build Coastguard Worker} 791*58b9f456SAndroid Build Coastguard Worker 792*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp, typename _Td> 793*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_fetch_add(_Atomic(_Tp)* __a, _Td __delta, 794*58b9f456SAndroid Build Coastguard Worker memory_order __order) { 795*58b9f456SAndroid Build Coastguard Worker return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value, 796*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 797*58b9f456SAndroid Build Coastguard Worker} 798*58b9f456SAndroid Build Coastguard Worker 799*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp, typename _Td> 800*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_fetch_sub(volatile _Atomic(_Tp)* __a, 801*58b9f456SAndroid Build Coastguard Worker _Td __delta, memory_order __order) { 802*58b9f456SAndroid Build Coastguard Worker return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value, 803*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 804*58b9f456SAndroid Build Coastguard Worker} 805*58b9f456SAndroid Build Coastguard Worker 806*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp, typename _Td> 807*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_fetch_sub(_Atomic(_Tp)* __a, _Td __delta, 808*58b9f456SAndroid Build Coastguard Worker memory_order __order) { 809*58b9f456SAndroid Build Coastguard Worker return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value, 810*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 811*58b9f456SAndroid Build Coastguard Worker} 812*58b9f456SAndroid Build Coastguard Worker 813*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 814*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_fetch_and(volatile _Atomic(_Tp)* __a, 815*58b9f456SAndroid Build Coastguard Worker _Tp __pattern, memory_order __order) { 816*58b9f456SAndroid Build Coastguard Worker return __atomic_fetch_and(&__a->__a_value, __pattern, 817*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 818*58b9f456SAndroid Build Coastguard Worker} 819*58b9f456SAndroid Build Coastguard Worker 820*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 821*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_fetch_and(_Atomic(_Tp)* __a, 822*58b9f456SAndroid Build Coastguard Worker _Tp __pattern, memory_order __order) { 823*58b9f456SAndroid Build Coastguard Worker return __atomic_fetch_and(&__a->__a_value, __pattern, 824*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 825*58b9f456SAndroid Build Coastguard Worker} 826*58b9f456SAndroid Build Coastguard Worker 827*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 828*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_fetch_or(volatile _Atomic(_Tp)* __a, 829*58b9f456SAndroid Build Coastguard Worker _Tp __pattern, memory_order __order) { 830*58b9f456SAndroid Build Coastguard Worker return __atomic_fetch_or(&__a->__a_value, __pattern, 831*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 832*58b9f456SAndroid Build Coastguard Worker} 833*58b9f456SAndroid Build Coastguard Worker 834*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 835*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_fetch_or(_Atomic(_Tp)* __a, _Tp __pattern, 836*58b9f456SAndroid Build Coastguard Worker memory_order __order) { 837*58b9f456SAndroid Build Coastguard Worker return __atomic_fetch_or(&__a->__a_value, __pattern, 838*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 839*58b9f456SAndroid Build Coastguard Worker} 840*58b9f456SAndroid Build Coastguard Worker 841*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 842*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_fetch_xor(volatile _Atomic(_Tp)* __a, 843*58b9f456SAndroid Build Coastguard Worker _Tp __pattern, memory_order __order) { 844*58b9f456SAndroid Build Coastguard Worker return __atomic_fetch_xor(&__a->__a_value, __pattern, 845*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 846*58b9f456SAndroid Build Coastguard Worker} 847*58b9f456SAndroid Build Coastguard Worker 848*58b9f456SAndroid Build Coastguard Workertemplate <typename _Tp> 849*58b9f456SAndroid Build Coastguard Workerstatic inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a, _Tp __pattern, 850*58b9f456SAndroid Build Coastguard Worker memory_order __order) { 851*58b9f456SAndroid Build Coastguard Worker return __atomic_fetch_xor(&__a->__a_value, __pattern, 852*58b9f456SAndroid Build Coastguard Worker __gcc_atomic::__to_gcc_order(__order)); 853*58b9f456SAndroid Build Coastguard Worker} 854*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP 855*58b9f456SAndroid Build Coastguard Worker 856*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 857*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 858*58b9f456SAndroid Build Coastguard Worker_Tp 859*58b9f456SAndroid Build Coastguard Workerkill_dependency(_Tp __y) _NOEXCEPT 860*58b9f456SAndroid Build Coastguard Worker{ 861*58b9f456SAndroid Build Coastguard Worker return __y; 862*58b9f456SAndroid Build Coastguard Worker} 863*58b9f456SAndroid Build Coastguard Worker 864*58b9f456SAndroid Build Coastguard Worker#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) 865*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE 866*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE 867*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE 868*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE 869*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 870*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE 871*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE 872*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE 873*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE 874*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE 875*58b9f456SAndroid Build Coastguard Worker#else 876*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE 877*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE 878*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE 879*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE 880*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE 881*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE 882*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE 883*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE 884*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE 885*58b9f456SAndroid Build Coastguard Worker# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE 886*58b9f456SAndroid Build Coastguard Worker#endif 887*58b9f456SAndroid Build Coastguard Worker 888*58b9f456SAndroid Build Coastguard Worker// general atomic<T> 889*58b9f456SAndroid Build Coastguard Worker 890*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value> 891*58b9f456SAndroid Build Coastguard Workerstruct __atomic_base // false 892*58b9f456SAndroid Build Coastguard Worker{ 893*58b9f456SAndroid Build Coastguard Worker mutable _Atomic(_Tp) __a_; 894*58b9f456SAndroid Build Coastguard Worker 895*58b9f456SAndroid Build Coastguard Worker#if defined(__cpp_lib_atomic_is_always_lock_free) 896*58b9f456SAndroid Build Coastguard Worker static _LIBCPP_CONSTEXPR bool is_always_lock_free = __atomic_always_lock_free(sizeof(__a_), 0); 897*58b9f456SAndroid Build Coastguard Worker#endif 898*58b9f456SAndroid Build Coastguard Worker 899*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 900*58b9f456SAndroid Build Coastguard Worker bool is_lock_free() const volatile _NOEXCEPT 901*58b9f456SAndroid Build Coastguard Worker { 902*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) 903*58b9f456SAndroid Build Coastguard Worker return __c11_atomic_is_lock_free(sizeof(_Tp)); 904*58b9f456SAndroid Build Coastguard Worker#else 905*58b9f456SAndroid Build Coastguard Worker return __atomic_is_lock_free(sizeof(_Tp), 0); 906*58b9f456SAndroid Build Coastguard Worker#endif 907*58b9f456SAndroid Build Coastguard Worker } 908*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 909*58b9f456SAndroid Build Coastguard Worker bool is_lock_free() const _NOEXCEPT 910*58b9f456SAndroid Build Coastguard Worker {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();} 911*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 912*58b9f456SAndroid Build Coastguard Worker void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT 913*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) 914*58b9f456SAndroid Build Coastguard Worker {__c11_atomic_store(&__a_, __d, __m);} 915*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 916*58b9f456SAndroid Build Coastguard Worker void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT 917*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) 918*58b9f456SAndroid Build Coastguard Worker {__c11_atomic_store(&__a_, __d, __m);} 919*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 920*58b9f456SAndroid Build Coastguard Worker _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT 921*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) 922*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_load(&__a_, __m);} 923*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 924*58b9f456SAndroid Build Coastguard Worker _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT 925*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) 926*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_load(&__a_, __m);} 927*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 928*58b9f456SAndroid Build Coastguard Worker operator _Tp() const volatile _NOEXCEPT {return load();} 929*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 930*58b9f456SAndroid Build Coastguard Worker operator _Tp() const _NOEXCEPT {return load();} 931*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 932*58b9f456SAndroid Build Coastguard Worker _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT 933*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_exchange(&__a_, __d, __m);} 934*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 935*58b9f456SAndroid Build Coastguard Worker _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT 936*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_exchange(&__a_, __d, __m);} 937*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 938*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(_Tp& __e, _Tp __d, 939*58b9f456SAndroid Build Coastguard Worker memory_order __s, memory_order __f) volatile _NOEXCEPT 940*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) 941*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} 942*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 943*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(_Tp& __e, _Tp __d, 944*58b9f456SAndroid Build Coastguard Worker memory_order __s, memory_order __f) _NOEXCEPT 945*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) 946*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} 947*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 948*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(_Tp& __e, _Tp __d, 949*58b9f456SAndroid Build Coastguard Worker memory_order __s, memory_order __f) volatile _NOEXCEPT 950*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) 951*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} 952*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 953*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(_Tp& __e, _Tp __d, 954*58b9f456SAndroid Build Coastguard Worker memory_order __s, memory_order __f) _NOEXCEPT 955*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) 956*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} 957*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 958*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(_Tp& __e, _Tp __d, 959*58b9f456SAndroid Build Coastguard Worker memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT 960*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} 961*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 962*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_weak(_Tp& __e, _Tp __d, 963*58b9f456SAndroid Build Coastguard Worker memory_order __m = memory_order_seq_cst) _NOEXCEPT 964*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} 965*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 966*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(_Tp& __e, _Tp __d, 967*58b9f456SAndroid Build Coastguard Worker memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT 968*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} 969*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 970*58b9f456SAndroid Build Coastguard Worker bool compare_exchange_strong(_Tp& __e, _Tp __d, 971*58b9f456SAndroid Build Coastguard Worker memory_order __m = memory_order_seq_cst) _NOEXCEPT 972*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} 973*58b9f456SAndroid Build Coastguard Worker 974*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 975*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 976*58b9f456SAndroid Build Coastguard Worker __atomic_base() _NOEXCEPT = default; 977*58b9f456SAndroid Build Coastguard Worker#else 978*58b9f456SAndroid Build Coastguard Worker __atomic_base() _NOEXCEPT : __a_() {} 979*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 980*58b9f456SAndroid Build Coastguard Worker 981*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 982*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {} 983*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 984*58b9f456SAndroid Build Coastguard Worker __atomic_base(const __atomic_base&) = delete; 985*58b9f456SAndroid Build Coastguard Worker __atomic_base& operator=(const __atomic_base&) = delete; 986*58b9f456SAndroid Build Coastguard Worker __atomic_base& operator=(const __atomic_base&) volatile = delete; 987*58b9f456SAndroid Build Coastguard Worker#else 988*58b9f456SAndroid Build Coastguard Workerprivate: 989*58b9f456SAndroid Build Coastguard Worker __atomic_base(const __atomic_base&); 990*58b9f456SAndroid Build Coastguard Worker __atomic_base& operator=(const __atomic_base&); 991*58b9f456SAndroid Build Coastguard Worker __atomic_base& operator=(const __atomic_base&) volatile; 992*58b9f456SAndroid Build Coastguard Worker#endif 993*58b9f456SAndroid Build Coastguard Worker}; 994*58b9f456SAndroid Build Coastguard Worker 995*58b9f456SAndroid Build Coastguard Worker#if defined(__cpp_lib_atomic_is_always_lock_free) 996*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, bool __b> 997*58b9f456SAndroid Build Coastguard Worker_LIBCPP_CONSTEXPR bool __atomic_base<_Tp, __b>::is_always_lock_free; 998*58b9f456SAndroid Build Coastguard Worker#endif 999*58b9f456SAndroid Build Coastguard Worker 1000*58b9f456SAndroid Build Coastguard Worker// atomic<Integral> 1001*58b9f456SAndroid Build Coastguard Worker 1002*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1003*58b9f456SAndroid Build Coastguard Workerstruct __atomic_base<_Tp, true> 1004*58b9f456SAndroid Build Coastguard Worker : public __atomic_base<_Tp, false> 1005*58b9f456SAndroid Build Coastguard Worker{ 1006*58b9f456SAndroid Build Coastguard Worker typedef __atomic_base<_Tp, false> __base; 1007*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1008*58b9f456SAndroid Build Coastguard Worker __atomic_base() _NOEXCEPT _LIBCPP_DEFAULT 1009*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1010*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {} 1011*58b9f456SAndroid Build Coastguard Worker 1012*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1013*58b9f456SAndroid Build Coastguard Worker _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT 1014*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} 1015*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1016*58b9f456SAndroid Build Coastguard Worker _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT 1017*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} 1018*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1019*58b9f456SAndroid Build Coastguard Worker _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT 1020*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} 1021*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1022*58b9f456SAndroid Build Coastguard Worker _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT 1023*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} 1024*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1025*58b9f456SAndroid Build Coastguard Worker _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT 1026*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_and(&this->__a_, __op, __m);} 1027*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1028*58b9f456SAndroid Build Coastguard Worker _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT 1029*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_and(&this->__a_, __op, __m);} 1030*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1031*58b9f456SAndroid Build Coastguard Worker _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT 1032*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_or(&this->__a_, __op, __m);} 1033*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1034*58b9f456SAndroid Build Coastguard Worker _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT 1035*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_or(&this->__a_, __op, __m);} 1036*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1037*58b9f456SAndroid Build Coastguard Worker _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT 1038*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);} 1039*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1040*58b9f456SAndroid Build Coastguard Worker _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT 1041*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);} 1042*58b9f456SAndroid Build Coastguard Worker 1043*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1044*58b9f456SAndroid Build Coastguard Worker _Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));} 1045*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1046*58b9f456SAndroid Build Coastguard Worker _Tp operator++(int) _NOEXCEPT {return fetch_add(_Tp(1));} 1047*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1048*58b9f456SAndroid Build Coastguard Worker _Tp operator--(int) volatile _NOEXCEPT {return fetch_sub(_Tp(1));} 1049*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1050*58b9f456SAndroid Build Coastguard Worker _Tp operator--(int) _NOEXCEPT {return fetch_sub(_Tp(1));} 1051*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1052*58b9f456SAndroid Build Coastguard Worker _Tp operator++() volatile _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);} 1053*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1054*58b9f456SAndroid Build Coastguard Worker _Tp operator++() _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);} 1055*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1056*58b9f456SAndroid Build Coastguard Worker _Tp operator--() volatile _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);} 1057*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1058*58b9f456SAndroid Build Coastguard Worker _Tp operator--() _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);} 1059*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1060*58b9f456SAndroid Build Coastguard Worker _Tp operator+=(_Tp __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;} 1061*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1062*58b9f456SAndroid Build Coastguard Worker _Tp operator+=(_Tp __op) _NOEXCEPT {return fetch_add(__op) + __op;} 1063*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1064*58b9f456SAndroid Build Coastguard Worker _Tp operator-=(_Tp __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;} 1065*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1066*58b9f456SAndroid Build Coastguard Worker _Tp operator-=(_Tp __op) _NOEXCEPT {return fetch_sub(__op) - __op;} 1067*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1068*58b9f456SAndroid Build Coastguard Worker _Tp operator&=(_Tp __op) volatile _NOEXCEPT {return fetch_and(__op) & __op;} 1069*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1070*58b9f456SAndroid Build Coastguard Worker _Tp operator&=(_Tp __op) _NOEXCEPT {return fetch_and(__op) & __op;} 1071*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1072*58b9f456SAndroid Build Coastguard Worker _Tp operator|=(_Tp __op) volatile _NOEXCEPT {return fetch_or(__op) | __op;} 1073*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1074*58b9f456SAndroid Build Coastguard Worker _Tp operator|=(_Tp __op) _NOEXCEPT {return fetch_or(__op) | __op;} 1075*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1076*58b9f456SAndroid Build Coastguard Worker _Tp operator^=(_Tp __op) volatile _NOEXCEPT {return fetch_xor(__op) ^ __op;} 1077*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1078*58b9f456SAndroid Build Coastguard Worker _Tp operator^=(_Tp __op) _NOEXCEPT {return fetch_xor(__op) ^ __op;} 1079*58b9f456SAndroid Build Coastguard Worker}; 1080*58b9f456SAndroid Build Coastguard Worker 1081*58b9f456SAndroid Build Coastguard Worker// atomic<T> 1082*58b9f456SAndroid Build Coastguard Worker 1083*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1084*58b9f456SAndroid Build Coastguard Workerstruct atomic 1085*58b9f456SAndroid Build Coastguard Worker : public __atomic_base<_Tp> 1086*58b9f456SAndroid Build Coastguard Worker{ 1087*58b9f456SAndroid Build Coastguard Worker typedef __atomic_base<_Tp> __base; 1088*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1089*58b9f456SAndroid Build Coastguard Worker atomic() _NOEXCEPT _LIBCPP_DEFAULT 1090*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1091*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {} 1092*58b9f456SAndroid Build Coastguard Worker 1093*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1094*58b9f456SAndroid Build Coastguard Worker _Tp operator=(_Tp __d) volatile _NOEXCEPT 1095*58b9f456SAndroid Build Coastguard Worker {__base::store(__d); return __d;} 1096*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1097*58b9f456SAndroid Build Coastguard Worker _Tp operator=(_Tp __d) _NOEXCEPT 1098*58b9f456SAndroid Build Coastguard Worker {__base::store(__d); return __d;} 1099*58b9f456SAndroid Build Coastguard Worker}; 1100*58b9f456SAndroid Build Coastguard Worker 1101*58b9f456SAndroid Build Coastguard Worker// atomic<T*> 1102*58b9f456SAndroid Build Coastguard Worker 1103*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1104*58b9f456SAndroid Build Coastguard Workerstruct atomic<_Tp*> 1105*58b9f456SAndroid Build Coastguard Worker : public __atomic_base<_Tp*> 1106*58b9f456SAndroid Build Coastguard Worker{ 1107*58b9f456SAndroid Build Coastguard Worker typedef __atomic_base<_Tp*> __base; 1108*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1109*58b9f456SAndroid Build Coastguard Worker atomic() _NOEXCEPT _LIBCPP_DEFAULT 1110*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1111*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {} 1112*58b9f456SAndroid Build Coastguard Worker 1113*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1114*58b9f456SAndroid Build Coastguard Worker _Tp* operator=(_Tp* __d) volatile _NOEXCEPT 1115*58b9f456SAndroid Build Coastguard Worker {__base::store(__d); return __d;} 1116*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1117*58b9f456SAndroid Build Coastguard Worker _Tp* operator=(_Tp* __d) _NOEXCEPT 1118*58b9f456SAndroid Build Coastguard Worker {__base::store(__d); return __d;} 1119*58b9f456SAndroid Build Coastguard Worker 1120*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1121*58b9f456SAndroid Build Coastguard Worker _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) 1122*58b9f456SAndroid Build Coastguard Worker volatile _NOEXCEPT 1123*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} 1124*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1125*58b9f456SAndroid Build Coastguard Worker _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT 1126*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_add(&this->__a_, __op, __m);} 1127*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1128*58b9f456SAndroid Build Coastguard Worker _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) 1129*58b9f456SAndroid Build Coastguard Worker volatile _NOEXCEPT 1130*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} 1131*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1132*58b9f456SAndroid Build Coastguard Worker _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT 1133*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);} 1134*58b9f456SAndroid Build Coastguard Worker 1135*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1136*58b9f456SAndroid Build Coastguard Worker _Tp* operator++(int) volatile _NOEXCEPT {return fetch_add(1);} 1137*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1138*58b9f456SAndroid Build Coastguard Worker _Tp* operator++(int) _NOEXCEPT {return fetch_add(1);} 1139*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1140*58b9f456SAndroid Build Coastguard Worker _Tp* operator--(int) volatile _NOEXCEPT {return fetch_sub(1);} 1141*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1142*58b9f456SAndroid Build Coastguard Worker _Tp* operator--(int) _NOEXCEPT {return fetch_sub(1);} 1143*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1144*58b9f456SAndroid Build Coastguard Worker _Tp* operator++() volatile _NOEXCEPT {return fetch_add(1) + 1;} 1145*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1146*58b9f456SAndroid Build Coastguard Worker _Tp* operator++() _NOEXCEPT {return fetch_add(1) + 1;} 1147*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1148*58b9f456SAndroid Build Coastguard Worker _Tp* operator--() volatile _NOEXCEPT {return fetch_sub(1) - 1;} 1149*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1150*58b9f456SAndroid Build Coastguard Worker _Tp* operator--() _NOEXCEPT {return fetch_sub(1) - 1;} 1151*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1152*58b9f456SAndroid Build Coastguard Worker _Tp* operator+=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;} 1153*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1154*58b9f456SAndroid Build Coastguard Worker _Tp* operator+=(ptrdiff_t __op) _NOEXCEPT {return fetch_add(__op) + __op;} 1155*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1156*58b9f456SAndroid Build Coastguard Worker _Tp* operator-=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;} 1157*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1158*58b9f456SAndroid Build Coastguard Worker _Tp* operator-=(ptrdiff_t __op) _NOEXCEPT {return fetch_sub(__op) - __op;} 1159*58b9f456SAndroid Build Coastguard Worker}; 1160*58b9f456SAndroid Build Coastguard Worker 1161*58b9f456SAndroid Build Coastguard Worker// atomic_is_lock_free 1162*58b9f456SAndroid Build Coastguard Worker 1163*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1164*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1165*58b9f456SAndroid Build Coastguard Workerbool 1166*58b9f456SAndroid Build Coastguard Workeratomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT 1167*58b9f456SAndroid Build Coastguard Worker{ 1168*58b9f456SAndroid Build Coastguard Worker return __o->is_lock_free(); 1169*58b9f456SAndroid Build Coastguard Worker} 1170*58b9f456SAndroid Build Coastguard Worker 1171*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1172*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1173*58b9f456SAndroid Build Coastguard Workerbool 1174*58b9f456SAndroid Build Coastguard Workeratomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT 1175*58b9f456SAndroid Build Coastguard Worker{ 1176*58b9f456SAndroid Build Coastguard Worker return __o->is_lock_free(); 1177*58b9f456SAndroid Build Coastguard Worker} 1178*58b9f456SAndroid Build Coastguard Worker 1179*58b9f456SAndroid Build Coastguard Worker// atomic_init 1180*58b9f456SAndroid Build Coastguard Worker 1181*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1182*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1183*58b9f456SAndroid Build Coastguard Workervoid 1184*58b9f456SAndroid Build Coastguard Workeratomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT 1185*58b9f456SAndroid Build Coastguard Worker{ 1186*58b9f456SAndroid Build Coastguard Worker __c11_atomic_init(&__o->__a_, __d); 1187*58b9f456SAndroid Build Coastguard Worker} 1188*58b9f456SAndroid Build Coastguard Worker 1189*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1190*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1191*58b9f456SAndroid Build Coastguard Workervoid 1192*58b9f456SAndroid Build Coastguard Workeratomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT 1193*58b9f456SAndroid Build Coastguard Worker{ 1194*58b9f456SAndroid Build Coastguard Worker __c11_atomic_init(&__o->__a_, __d); 1195*58b9f456SAndroid Build Coastguard Worker} 1196*58b9f456SAndroid Build Coastguard Worker 1197*58b9f456SAndroid Build Coastguard Worker// atomic_store 1198*58b9f456SAndroid Build Coastguard Worker 1199*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1200*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1201*58b9f456SAndroid Build Coastguard Workervoid 1202*58b9f456SAndroid Build Coastguard Workeratomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT 1203*58b9f456SAndroid Build Coastguard Worker{ 1204*58b9f456SAndroid Build Coastguard Worker __o->store(__d); 1205*58b9f456SAndroid Build Coastguard Worker} 1206*58b9f456SAndroid Build Coastguard Worker 1207*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1208*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1209*58b9f456SAndroid Build Coastguard Workervoid 1210*58b9f456SAndroid Build Coastguard Workeratomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT 1211*58b9f456SAndroid Build Coastguard Worker{ 1212*58b9f456SAndroid Build Coastguard Worker __o->store(__d); 1213*58b9f456SAndroid Build Coastguard Worker} 1214*58b9f456SAndroid Build Coastguard Worker 1215*58b9f456SAndroid Build Coastguard Worker// atomic_store_explicit 1216*58b9f456SAndroid Build Coastguard Worker 1217*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1218*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1219*58b9f456SAndroid Build Coastguard Workervoid 1220*58b9f456SAndroid Build Coastguard Workeratomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT 1221*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) 1222*58b9f456SAndroid Build Coastguard Worker{ 1223*58b9f456SAndroid Build Coastguard Worker __o->store(__d, __m); 1224*58b9f456SAndroid Build Coastguard Worker} 1225*58b9f456SAndroid Build Coastguard Worker 1226*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1227*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1228*58b9f456SAndroid Build Coastguard Workervoid 1229*58b9f456SAndroid Build Coastguard Workeratomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT 1230*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) 1231*58b9f456SAndroid Build Coastguard Worker{ 1232*58b9f456SAndroid Build Coastguard Worker __o->store(__d, __m); 1233*58b9f456SAndroid Build Coastguard Worker} 1234*58b9f456SAndroid Build Coastguard Worker 1235*58b9f456SAndroid Build Coastguard Worker// atomic_load 1236*58b9f456SAndroid Build Coastguard Worker 1237*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1238*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1239*58b9f456SAndroid Build Coastguard Worker_Tp 1240*58b9f456SAndroid Build Coastguard Workeratomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT 1241*58b9f456SAndroid Build Coastguard Worker{ 1242*58b9f456SAndroid Build Coastguard Worker return __o->load(); 1243*58b9f456SAndroid Build Coastguard Worker} 1244*58b9f456SAndroid Build Coastguard Worker 1245*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1246*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1247*58b9f456SAndroid Build Coastguard Worker_Tp 1248*58b9f456SAndroid Build Coastguard Workeratomic_load(const atomic<_Tp>* __o) _NOEXCEPT 1249*58b9f456SAndroid Build Coastguard Worker{ 1250*58b9f456SAndroid Build Coastguard Worker return __o->load(); 1251*58b9f456SAndroid Build Coastguard Worker} 1252*58b9f456SAndroid Build Coastguard Worker 1253*58b9f456SAndroid Build Coastguard Worker// atomic_load_explicit 1254*58b9f456SAndroid Build Coastguard Worker 1255*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1256*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1257*58b9f456SAndroid Build Coastguard Worker_Tp 1258*58b9f456SAndroid Build Coastguard Workeratomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT 1259*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) 1260*58b9f456SAndroid Build Coastguard Worker{ 1261*58b9f456SAndroid Build Coastguard Worker return __o->load(__m); 1262*58b9f456SAndroid Build Coastguard Worker} 1263*58b9f456SAndroid Build Coastguard Worker 1264*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1265*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1266*58b9f456SAndroid Build Coastguard Worker_Tp 1267*58b9f456SAndroid Build Coastguard Workeratomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT 1268*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) 1269*58b9f456SAndroid Build Coastguard Worker{ 1270*58b9f456SAndroid Build Coastguard Worker return __o->load(__m); 1271*58b9f456SAndroid Build Coastguard Worker} 1272*58b9f456SAndroid Build Coastguard Worker 1273*58b9f456SAndroid Build Coastguard Worker// atomic_exchange 1274*58b9f456SAndroid Build Coastguard Worker 1275*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1276*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1277*58b9f456SAndroid Build Coastguard Worker_Tp 1278*58b9f456SAndroid Build Coastguard Workeratomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT 1279*58b9f456SAndroid Build Coastguard Worker{ 1280*58b9f456SAndroid Build Coastguard Worker return __o->exchange(__d); 1281*58b9f456SAndroid Build Coastguard Worker} 1282*58b9f456SAndroid Build Coastguard Worker 1283*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1284*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1285*58b9f456SAndroid Build Coastguard Worker_Tp 1286*58b9f456SAndroid Build Coastguard Workeratomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT 1287*58b9f456SAndroid Build Coastguard Worker{ 1288*58b9f456SAndroid Build Coastguard Worker return __o->exchange(__d); 1289*58b9f456SAndroid Build Coastguard Worker} 1290*58b9f456SAndroid Build Coastguard Worker 1291*58b9f456SAndroid Build Coastguard Worker// atomic_exchange_explicit 1292*58b9f456SAndroid Build Coastguard Worker 1293*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1294*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1295*58b9f456SAndroid Build Coastguard Worker_Tp 1296*58b9f456SAndroid Build Coastguard Workeratomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT 1297*58b9f456SAndroid Build Coastguard Worker{ 1298*58b9f456SAndroid Build Coastguard Worker return __o->exchange(__d, __m); 1299*58b9f456SAndroid Build Coastguard Worker} 1300*58b9f456SAndroid Build Coastguard Worker 1301*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1302*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1303*58b9f456SAndroid Build Coastguard Worker_Tp 1304*58b9f456SAndroid Build Coastguard Workeratomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT 1305*58b9f456SAndroid Build Coastguard Worker{ 1306*58b9f456SAndroid Build Coastguard Worker return __o->exchange(__d, __m); 1307*58b9f456SAndroid Build Coastguard Worker} 1308*58b9f456SAndroid Build Coastguard Worker 1309*58b9f456SAndroid Build Coastguard Worker// atomic_compare_exchange_weak 1310*58b9f456SAndroid Build Coastguard Worker 1311*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1312*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1313*58b9f456SAndroid Build Coastguard Workerbool 1314*58b9f456SAndroid Build Coastguard Workeratomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT 1315*58b9f456SAndroid Build Coastguard Worker{ 1316*58b9f456SAndroid Build Coastguard Worker return __o->compare_exchange_weak(*__e, __d); 1317*58b9f456SAndroid Build Coastguard Worker} 1318*58b9f456SAndroid Build Coastguard Worker 1319*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1320*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1321*58b9f456SAndroid Build Coastguard Workerbool 1322*58b9f456SAndroid Build Coastguard Workeratomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT 1323*58b9f456SAndroid Build Coastguard Worker{ 1324*58b9f456SAndroid Build Coastguard Worker return __o->compare_exchange_weak(*__e, __d); 1325*58b9f456SAndroid Build Coastguard Worker} 1326*58b9f456SAndroid Build Coastguard Worker 1327*58b9f456SAndroid Build Coastguard Worker// atomic_compare_exchange_strong 1328*58b9f456SAndroid Build Coastguard Worker 1329*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1330*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1331*58b9f456SAndroid Build Coastguard Workerbool 1332*58b9f456SAndroid Build Coastguard Workeratomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT 1333*58b9f456SAndroid Build Coastguard Worker{ 1334*58b9f456SAndroid Build Coastguard Worker return __o->compare_exchange_strong(*__e, __d); 1335*58b9f456SAndroid Build Coastguard Worker} 1336*58b9f456SAndroid Build Coastguard Worker 1337*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1338*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1339*58b9f456SAndroid Build Coastguard Workerbool 1340*58b9f456SAndroid Build Coastguard Workeratomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT 1341*58b9f456SAndroid Build Coastguard Worker{ 1342*58b9f456SAndroid Build Coastguard Worker return __o->compare_exchange_strong(*__e, __d); 1343*58b9f456SAndroid Build Coastguard Worker} 1344*58b9f456SAndroid Build Coastguard Worker 1345*58b9f456SAndroid Build Coastguard Worker// atomic_compare_exchange_weak_explicit 1346*58b9f456SAndroid Build Coastguard Worker 1347*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1348*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1349*58b9f456SAndroid Build Coastguard Workerbool 1350*58b9f456SAndroid Build Coastguard Workeratomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e, 1351*58b9f456SAndroid Build Coastguard Worker _Tp __d, 1352*58b9f456SAndroid Build Coastguard Worker memory_order __s, memory_order __f) _NOEXCEPT 1353*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) 1354*58b9f456SAndroid Build Coastguard Worker{ 1355*58b9f456SAndroid Build Coastguard Worker return __o->compare_exchange_weak(*__e, __d, __s, __f); 1356*58b9f456SAndroid Build Coastguard Worker} 1357*58b9f456SAndroid Build Coastguard Worker 1358*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1359*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1360*58b9f456SAndroid Build Coastguard Workerbool 1361*58b9f456SAndroid Build Coastguard Workeratomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d, 1362*58b9f456SAndroid Build Coastguard Worker memory_order __s, memory_order __f) _NOEXCEPT 1363*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) 1364*58b9f456SAndroid Build Coastguard Worker{ 1365*58b9f456SAndroid Build Coastguard Worker return __o->compare_exchange_weak(*__e, __d, __s, __f); 1366*58b9f456SAndroid Build Coastguard Worker} 1367*58b9f456SAndroid Build Coastguard Worker 1368*58b9f456SAndroid Build Coastguard Worker// atomic_compare_exchange_strong_explicit 1369*58b9f456SAndroid Build Coastguard Worker 1370*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1371*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1372*58b9f456SAndroid Build Coastguard Workerbool 1373*58b9f456SAndroid Build Coastguard Workeratomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o, 1374*58b9f456SAndroid Build Coastguard Worker _Tp* __e, _Tp __d, 1375*58b9f456SAndroid Build Coastguard Worker memory_order __s, memory_order __f) _NOEXCEPT 1376*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) 1377*58b9f456SAndroid Build Coastguard Worker{ 1378*58b9f456SAndroid Build Coastguard Worker return __o->compare_exchange_strong(*__e, __d, __s, __f); 1379*58b9f456SAndroid Build Coastguard Worker} 1380*58b9f456SAndroid Build Coastguard Worker 1381*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1382*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1383*58b9f456SAndroid Build Coastguard Workerbool 1384*58b9f456SAndroid Build Coastguard Workeratomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e, 1385*58b9f456SAndroid Build Coastguard Worker _Tp __d, 1386*58b9f456SAndroid Build Coastguard Worker memory_order __s, memory_order __f) _NOEXCEPT 1387*58b9f456SAndroid Build Coastguard Worker _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) 1388*58b9f456SAndroid Build Coastguard Worker{ 1389*58b9f456SAndroid Build Coastguard Worker return __o->compare_exchange_strong(*__e, __d, __s, __f); 1390*58b9f456SAndroid Build Coastguard Worker} 1391*58b9f456SAndroid Build Coastguard Worker 1392*58b9f456SAndroid Build Coastguard Worker// atomic_fetch_add 1393*58b9f456SAndroid Build Coastguard Worker 1394*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1395*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1396*58b9f456SAndroid Build Coastguard Workertypename enable_if 1397*58b9f456SAndroid Build Coastguard Worker< 1398*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1399*58b9f456SAndroid Build Coastguard Worker _Tp 1400*58b9f456SAndroid Build Coastguard Worker>::type 1401*58b9f456SAndroid Build Coastguard Workeratomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT 1402*58b9f456SAndroid Build Coastguard Worker{ 1403*58b9f456SAndroid Build Coastguard Worker return __o->fetch_add(__op); 1404*58b9f456SAndroid Build Coastguard Worker} 1405*58b9f456SAndroid Build Coastguard Worker 1406*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1407*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1408*58b9f456SAndroid Build Coastguard Workertypename enable_if 1409*58b9f456SAndroid Build Coastguard Worker< 1410*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1411*58b9f456SAndroid Build Coastguard Worker _Tp 1412*58b9f456SAndroid Build Coastguard Worker>::type 1413*58b9f456SAndroid Build Coastguard Workeratomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT 1414*58b9f456SAndroid Build Coastguard Worker{ 1415*58b9f456SAndroid Build Coastguard Worker return __o->fetch_add(__op); 1416*58b9f456SAndroid Build Coastguard Worker} 1417*58b9f456SAndroid Build Coastguard Worker 1418*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1419*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1420*58b9f456SAndroid Build Coastguard Worker_Tp* 1421*58b9f456SAndroid Build Coastguard Workeratomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT 1422*58b9f456SAndroid Build Coastguard Worker{ 1423*58b9f456SAndroid Build Coastguard Worker return __o->fetch_add(__op); 1424*58b9f456SAndroid Build Coastguard Worker} 1425*58b9f456SAndroid Build Coastguard Worker 1426*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1427*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1428*58b9f456SAndroid Build Coastguard Worker_Tp* 1429*58b9f456SAndroid Build Coastguard Workeratomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT 1430*58b9f456SAndroid Build Coastguard Worker{ 1431*58b9f456SAndroid Build Coastguard Worker return __o->fetch_add(__op); 1432*58b9f456SAndroid Build Coastguard Worker} 1433*58b9f456SAndroid Build Coastguard Worker 1434*58b9f456SAndroid Build Coastguard Worker// atomic_fetch_add_explicit 1435*58b9f456SAndroid Build Coastguard Worker 1436*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1437*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1438*58b9f456SAndroid Build Coastguard Workertypename enable_if 1439*58b9f456SAndroid Build Coastguard Worker< 1440*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1441*58b9f456SAndroid Build Coastguard Worker _Tp 1442*58b9f456SAndroid Build Coastguard Worker>::type 1443*58b9f456SAndroid Build Coastguard Workeratomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT 1444*58b9f456SAndroid Build Coastguard Worker{ 1445*58b9f456SAndroid Build Coastguard Worker return __o->fetch_add(__op, __m); 1446*58b9f456SAndroid Build Coastguard Worker} 1447*58b9f456SAndroid Build Coastguard Worker 1448*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1449*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1450*58b9f456SAndroid Build Coastguard Workertypename enable_if 1451*58b9f456SAndroid Build Coastguard Worker< 1452*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1453*58b9f456SAndroid Build Coastguard Worker _Tp 1454*58b9f456SAndroid Build Coastguard Worker>::type 1455*58b9f456SAndroid Build Coastguard Workeratomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT 1456*58b9f456SAndroid Build Coastguard Worker{ 1457*58b9f456SAndroid Build Coastguard Worker return __o->fetch_add(__op, __m); 1458*58b9f456SAndroid Build Coastguard Worker} 1459*58b9f456SAndroid Build Coastguard Worker 1460*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1461*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1462*58b9f456SAndroid Build Coastguard Worker_Tp* 1463*58b9f456SAndroid Build Coastguard Workeratomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, 1464*58b9f456SAndroid Build Coastguard Worker memory_order __m) _NOEXCEPT 1465*58b9f456SAndroid Build Coastguard Worker{ 1466*58b9f456SAndroid Build Coastguard Worker return __o->fetch_add(__op, __m); 1467*58b9f456SAndroid Build Coastguard Worker} 1468*58b9f456SAndroid Build Coastguard Worker 1469*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1470*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1471*58b9f456SAndroid Build Coastguard Worker_Tp* 1472*58b9f456SAndroid Build Coastguard Workeratomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT 1473*58b9f456SAndroid Build Coastguard Worker{ 1474*58b9f456SAndroid Build Coastguard Worker return __o->fetch_add(__op, __m); 1475*58b9f456SAndroid Build Coastguard Worker} 1476*58b9f456SAndroid Build Coastguard Worker 1477*58b9f456SAndroid Build Coastguard Worker// atomic_fetch_sub 1478*58b9f456SAndroid Build Coastguard Worker 1479*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1480*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1481*58b9f456SAndroid Build Coastguard Workertypename enable_if 1482*58b9f456SAndroid Build Coastguard Worker< 1483*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1484*58b9f456SAndroid Build Coastguard Worker _Tp 1485*58b9f456SAndroid Build Coastguard Worker>::type 1486*58b9f456SAndroid Build Coastguard Workeratomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT 1487*58b9f456SAndroid Build Coastguard Worker{ 1488*58b9f456SAndroid Build Coastguard Worker return __o->fetch_sub(__op); 1489*58b9f456SAndroid Build Coastguard Worker} 1490*58b9f456SAndroid Build Coastguard Worker 1491*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1492*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1493*58b9f456SAndroid Build Coastguard Workertypename enable_if 1494*58b9f456SAndroid Build Coastguard Worker< 1495*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1496*58b9f456SAndroid Build Coastguard Worker _Tp 1497*58b9f456SAndroid Build Coastguard Worker>::type 1498*58b9f456SAndroid Build Coastguard Workeratomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT 1499*58b9f456SAndroid Build Coastguard Worker{ 1500*58b9f456SAndroid Build Coastguard Worker return __o->fetch_sub(__op); 1501*58b9f456SAndroid Build Coastguard Worker} 1502*58b9f456SAndroid Build Coastguard Worker 1503*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1504*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1505*58b9f456SAndroid Build Coastguard Worker_Tp* 1506*58b9f456SAndroid Build Coastguard Workeratomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT 1507*58b9f456SAndroid Build Coastguard Worker{ 1508*58b9f456SAndroid Build Coastguard Worker return __o->fetch_sub(__op); 1509*58b9f456SAndroid Build Coastguard Worker} 1510*58b9f456SAndroid Build Coastguard Worker 1511*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1512*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1513*58b9f456SAndroid Build Coastguard Worker_Tp* 1514*58b9f456SAndroid Build Coastguard Workeratomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT 1515*58b9f456SAndroid Build Coastguard Worker{ 1516*58b9f456SAndroid Build Coastguard Worker return __o->fetch_sub(__op); 1517*58b9f456SAndroid Build Coastguard Worker} 1518*58b9f456SAndroid Build Coastguard Worker 1519*58b9f456SAndroid Build Coastguard Worker// atomic_fetch_sub_explicit 1520*58b9f456SAndroid Build Coastguard Worker 1521*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1522*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1523*58b9f456SAndroid Build Coastguard Workertypename enable_if 1524*58b9f456SAndroid Build Coastguard Worker< 1525*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1526*58b9f456SAndroid Build Coastguard Worker _Tp 1527*58b9f456SAndroid Build Coastguard Worker>::type 1528*58b9f456SAndroid Build Coastguard Workeratomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT 1529*58b9f456SAndroid Build Coastguard Worker{ 1530*58b9f456SAndroid Build Coastguard Worker return __o->fetch_sub(__op, __m); 1531*58b9f456SAndroid Build Coastguard Worker} 1532*58b9f456SAndroid Build Coastguard Worker 1533*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1534*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1535*58b9f456SAndroid Build Coastguard Workertypename enable_if 1536*58b9f456SAndroid Build Coastguard Worker< 1537*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1538*58b9f456SAndroid Build Coastguard Worker _Tp 1539*58b9f456SAndroid Build Coastguard Worker>::type 1540*58b9f456SAndroid Build Coastguard Workeratomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT 1541*58b9f456SAndroid Build Coastguard Worker{ 1542*58b9f456SAndroid Build Coastguard Worker return __o->fetch_sub(__op, __m); 1543*58b9f456SAndroid Build Coastguard Worker} 1544*58b9f456SAndroid Build Coastguard Worker 1545*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1546*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1547*58b9f456SAndroid Build Coastguard Worker_Tp* 1548*58b9f456SAndroid Build Coastguard Workeratomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, 1549*58b9f456SAndroid Build Coastguard Worker memory_order __m) _NOEXCEPT 1550*58b9f456SAndroid Build Coastguard Worker{ 1551*58b9f456SAndroid Build Coastguard Worker return __o->fetch_sub(__op, __m); 1552*58b9f456SAndroid Build Coastguard Worker} 1553*58b9f456SAndroid Build Coastguard Worker 1554*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1555*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1556*58b9f456SAndroid Build Coastguard Worker_Tp* 1557*58b9f456SAndroid Build Coastguard Workeratomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT 1558*58b9f456SAndroid Build Coastguard Worker{ 1559*58b9f456SAndroid Build Coastguard Worker return __o->fetch_sub(__op, __m); 1560*58b9f456SAndroid Build Coastguard Worker} 1561*58b9f456SAndroid Build Coastguard Worker 1562*58b9f456SAndroid Build Coastguard Worker// atomic_fetch_and 1563*58b9f456SAndroid Build Coastguard Worker 1564*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1565*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1566*58b9f456SAndroid Build Coastguard Workertypename enable_if 1567*58b9f456SAndroid Build Coastguard Worker< 1568*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1569*58b9f456SAndroid Build Coastguard Worker _Tp 1570*58b9f456SAndroid Build Coastguard Worker>::type 1571*58b9f456SAndroid Build Coastguard Workeratomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT 1572*58b9f456SAndroid Build Coastguard Worker{ 1573*58b9f456SAndroid Build Coastguard Worker return __o->fetch_and(__op); 1574*58b9f456SAndroid Build Coastguard Worker} 1575*58b9f456SAndroid Build Coastguard Worker 1576*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1577*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1578*58b9f456SAndroid Build Coastguard Workertypename enable_if 1579*58b9f456SAndroid Build Coastguard Worker< 1580*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1581*58b9f456SAndroid Build Coastguard Worker _Tp 1582*58b9f456SAndroid Build Coastguard Worker>::type 1583*58b9f456SAndroid Build Coastguard Workeratomic_fetch_and(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT 1584*58b9f456SAndroid Build Coastguard Worker{ 1585*58b9f456SAndroid Build Coastguard Worker return __o->fetch_and(__op); 1586*58b9f456SAndroid Build Coastguard Worker} 1587*58b9f456SAndroid Build Coastguard Worker 1588*58b9f456SAndroid Build Coastguard Worker// atomic_fetch_and_explicit 1589*58b9f456SAndroid Build Coastguard Worker 1590*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1591*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1592*58b9f456SAndroid Build Coastguard Workertypename enable_if 1593*58b9f456SAndroid Build Coastguard Worker< 1594*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1595*58b9f456SAndroid Build Coastguard Worker _Tp 1596*58b9f456SAndroid Build Coastguard Worker>::type 1597*58b9f456SAndroid Build Coastguard Workeratomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT 1598*58b9f456SAndroid Build Coastguard Worker{ 1599*58b9f456SAndroid Build Coastguard Worker return __o->fetch_and(__op, __m); 1600*58b9f456SAndroid Build Coastguard Worker} 1601*58b9f456SAndroid Build Coastguard Worker 1602*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1603*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1604*58b9f456SAndroid Build Coastguard Workertypename enable_if 1605*58b9f456SAndroid Build Coastguard Worker< 1606*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1607*58b9f456SAndroid Build Coastguard Worker _Tp 1608*58b9f456SAndroid Build Coastguard Worker>::type 1609*58b9f456SAndroid Build Coastguard Workeratomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT 1610*58b9f456SAndroid Build Coastguard Worker{ 1611*58b9f456SAndroid Build Coastguard Worker return __o->fetch_and(__op, __m); 1612*58b9f456SAndroid Build Coastguard Worker} 1613*58b9f456SAndroid Build Coastguard Worker 1614*58b9f456SAndroid Build Coastguard Worker// atomic_fetch_or 1615*58b9f456SAndroid Build Coastguard Worker 1616*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1617*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1618*58b9f456SAndroid Build Coastguard Workertypename enable_if 1619*58b9f456SAndroid Build Coastguard Worker< 1620*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1621*58b9f456SAndroid Build Coastguard Worker _Tp 1622*58b9f456SAndroid Build Coastguard Worker>::type 1623*58b9f456SAndroid Build Coastguard Workeratomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT 1624*58b9f456SAndroid Build Coastguard Worker{ 1625*58b9f456SAndroid Build Coastguard Worker return __o->fetch_or(__op); 1626*58b9f456SAndroid Build Coastguard Worker} 1627*58b9f456SAndroid Build Coastguard Worker 1628*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1629*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1630*58b9f456SAndroid Build Coastguard Workertypename enable_if 1631*58b9f456SAndroid Build Coastguard Worker< 1632*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1633*58b9f456SAndroid Build Coastguard Worker _Tp 1634*58b9f456SAndroid Build Coastguard Worker>::type 1635*58b9f456SAndroid Build Coastguard Workeratomic_fetch_or(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT 1636*58b9f456SAndroid Build Coastguard Worker{ 1637*58b9f456SAndroid Build Coastguard Worker return __o->fetch_or(__op); 1638*58b9f456SAndroid Build Coastguard Worker} 1639*58b9f456SAndroid Build Coastguard Worker 1640*58b9f456SAndroid Build Coastguard Worker// atomic_fetch_or_explicit 1641*58b9f456SAndroid Build Coastguard Worker 1642*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1643*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1644*58b9f456SAndroid Build Coastguard Workertypename enable_if 1645*58b9f456SAndroid Build Coastguard Worker< 1646*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1647*58b9f456SAndroid Build Coastguard Worker _Tp 1648*58b9f456SAndroid Build Coastguard Worker>::type 1649*58b9f456SAndroid Build Coastguard Workeratomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT 1650*58b9f456SAndroid Build Coastguard Worker{ 1651*58b9f456SAndroid Build Coastguard Worker return __o->fetch_or(__op, __m); 1652*58b9f456SAndroid Build Coastguard Worker} 1653*58b9f456SAndroid Build Coastguard Worker 1654*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1655*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1656*58b9f456SAndroid Build Coastguard Workertypename enable_if 1657*58b9f456SAndroid Build Coastguard Worker< 1658*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1659*58b9f456SAndroid Build Coastguard Worker _Tp 1660*58b9f456SAndroid Build Coastguard Worker>::type 1661*58b9f456SAndroid Build Coastguard Workeratomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT 1662*58b9f456SAndroid Build Coastguard Worker{ 1663*58b9f456SAndroid Build Coastguard Worker return __o->fetch_or(__op, __m); 1664*58b9f456SAndroid Build Coastguard Worker} 1665*58b9f456SAndroid Build Coastguard Worker 1666*58b9f456SAndroid Build Coastguard Worker// atomic_fetch_xor 1667*58b9f456SAndroid Build Coastguard Worker 1668*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1669*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1670*58b9f456SAndroid Build Coastguard Workertypename enable_if 1671*58b9f456SAndroid Build Coastguard Worker< 1672*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1673*58b9f456SAndroid Build Coastguard Worker _Tp 1674*58b9f456SAndroid Build Coastguard Worker>::type 1675*58b9f456SAndroid Build Coastguard Workeratomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT 1676*58b9f456SAndroid Build Coastguard Worker{ 1677*58b9f456SAndroid Build Coastguard Worker return __o->fetch_xor(__op); 1678*58b9f456SAndroid Build Coastguard Worker} 1679*58b9f456SAndroid Build Coastguard Worker 1680*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1681*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1682*58b9f456SAndroid Build Coastguard Workertypename enable_if 1683*58b9f456SAndroid Build Coastguard Worker< 1684*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1685*58b9f456SAndroid Build Coastguard Worker _Tp 1686*58b9f456SAndroid Build Coastguard Worker>::type 1687*58b9f456SAndroid Build Coastguard Workeratomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT 1688*58b9f456SAndroid Build Coastguard Worker{ 1689*58b9f456SAndroid Build Coastguard Worker return __o->fetch_xor(__op); 1690*58b9f456SAndroid Build Coastguard Worker} 1691*58b9f456SAndroid Build Coastguard Worker 1692*58b9f456SAndroid Build Coastguard Worker// atomic_fetch_xor_explicit 1693*58b9f456SAndroid Build Coastguard Worker 1694*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1695*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1696*58b9f456SAndroid Build Coastguard Workertypename enable_if 1697*58b9f456SAndroid Build Coastguard Worker< 1698*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1699*58b9f456SAndroid Build Coastguard Worker _Tp 1700*58b9f456SAndroid Build Coastguard Worker>::type 1701*58b9f456SAndroid Build Coastguard Workeratomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT 1702*58b9f456SAndroid Build Coastguard Worker{ 1703*58b9f456SAndroid Build Coastguard Worker return __o->fetch_xor(__op, __m); 1704*58b9f456SAndroid Build Coastguard Worker} 1705*58b9f456SAndroid Build Coastguard Worker 1706*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp> 1707*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1708*58b9f456SAndroid Build Coastguard Workertypename enable_if 1709*58b9f456SAndroid Build Coastguard Worker< 1710*58b9f456SAndroid Build Coastguard Worker is_integral<_Tp>::value && !is_same<_Tp, bool>::value, 1711*58b9f456SAndroid Build Coastguard Worker _Tp 1712*58b9f456SAndroid Build Coastguard Worker>::type 1713*58b9f456SAndroid Build Coastguard Workeratomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT 1714*58b9f456SAndroid Build Coastguard Worker{ 1715*58b9f456SAndroid Build Coastguard Worker return __o->fetch_xor(__op, __m); 1716*58b9f456SAndroid Build Coastguard Worker} 1717*58b9f456SAndroid Build Coastguard Worker 1718*58b9f456SAndroid Build Coastguard Worker// flag type and operations 1719*58b9f456SAndroid Build Coastguard Worker 1720*58b9f456SAndroid Build Coastguard Workertypedef struct atomic_flag 1721*58b9f456SAndroid Build Coastguard Worker{ 1722*58b9f456SAndroid Build Coastguard Worker _Atomic(bool) __a_; 1723*58b9f456SAndroid Build Coastguard Worker 1724*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1725*58b9f456SAndroid Build Coastguard Worker bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT 1726*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_exchange(&__a_, true, __m);} 1727*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1728*58b9f456SAndroid Build Coastguard Worker bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT 1729*58b9f456SAndroid Build Coastguard Worker {return __c11_atomic_exchange(&__a_, true, __m);} 1730*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1731*58b9f456SAndroid Build Coastguard Worker void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT 1732*58b9f456SAndroid Build Coastguard Worker {__c11_atomic_store(&__a_, false, __m);} 1733*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1734*58b9f456SAndroid Build Coastguard Worker void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT 1735*58b9f456SAndroid Build Coastguard Worker {__c11_atomic_store(&__a_, false, __m);} 1736*58b9f456SAndroid Build Coastguard Worker 1737*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 1738*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 1739*58b9f456SAndroid Build Coastguard Worker atomic_flag() _NOEXCEPT = default; 1740*58b9f456SAndroid Build Coastguard Worker#else 1741*58b9f456SAndroid Build Coastguard Worker atomic_flag() _NOEXCEPT : __a_() {} 1742*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 1743*58b9f456SAndroid Build Coastguard Worker 1744*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR 1745*58b9f456SAndroid Build Coastguard Worker atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION 1746*58b9f456SAndroid Build Coastguard Worker 1747*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 1748*58b9f456SAndroid Build Coastguard Worker atomic_flag(const atomic_flag&) = delete; 1749*58b9f456SAndroid Build Coastguard Worker atomic_flag& operator=(const atomic_flag&) = delete; 1750*58b9f456SAndroid Build Coastguard Worker atomic_flag& operator=(const atomic_flag&) volatile = delete; 1751*58b9f456SAndroid Build Coastguard Worker#else 1752*58b9f456SAndroid Build Coastguard Workerprivate: 1753*58b9f456SAndroid Build Coastguard Worker atomic_flag(const atomic_flag&); 1754*58b9f456SAndroid Build Coastguard Worker atomic_flag& operator=(const atomic_flag&); 1755*58b9f456SAndroid Build Coastguard Worker atomic_flag& operator=(const atomic_flag&) volatile; 1756*58b9f456SAndroid Build Coastguard Worker#endif 1757*58b9f456SAndroid Build Coastguard Worker} atomic_flag; 1758*58b9f456SAndroid Build Coastguard Worker 1759*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1760*58b9f456SAndroid Build Coastguard Workerbool 1761*58b9f456SAndroid Build Coastguard Workeratomic_flag_test_and_set(volatile atomic_flag* __o) _NOEXCEPT 1762*58b9f456SAndroid Build Coastguard Worker{ 1763*58b9f456SAndroid Build Coastguard Worker return __o->test_and_set(); 1764*58b9f456SAndroid Build Coastguard Worker} 1765*58b9f456SAndroid Build Coastguard Worker 1766*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1767*58b9f456SAndroid Build Coastguard Workerbool 1768*58b9f456SAndroid Build Coastguard Workeratomic_flag_test_and_set(atomic_flag* __o) _NOEXCEPT 1769*58b9f456SAndroid Build Coastguard Worker{ 1770*58b9f456SAndroid Build Coastguard Worker return __o->test_and_set(); 1771*58b9f456SAndroid Build Coastguard Worker} 1772*58b9f456SAndroid Build Coastguard Worker 1773*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1774*58b9f456SAndroid Build Coastguard Workerbool 1775*58b9f456SAndroid Build Coastguard Workeratomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT 1776*58b9f456SAndroid Build Coastguard Worker{ 1777*58b9f456SAndroid Build Coastguard Worker return __o->test_and_set(__m); 1778*58b9f456SAndroid Build Coastguard Worker} 1779*58b9f456SAndroid Build Coastguard Worker 1780*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1781*58b9f456SAndroid Build Coastguard Workerbool 1782*58b9f456SAndroid Build Coastguard Workeratomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT 1783*58b9f456SAndroid Build Coastguard Worker{ 1784*58b9f456SAndroid Build Coastguard Worker return __o->test_and_set(__m); 1785*58b9f456SAndroid Build Coastguard Worker} 1786*58b9f456SAndroid Build Coastguard Worker 1787*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1788*58b9f456SAndroid Build Coastguard Workervoid 1789*58b9f456SAndroid Build Coastguard Workeratomic_flag_clear(volatile atomic_flag* __o) _NOEXCEPT 1790*58b9f456SAndroid Build Coastguard Worker{ 1791*58b9f456SAndroid Build Coastguard Worker __o->clear(); 1792*58b9f456SAndroid Build Coastguard Worker} 1793*58b9f456SAndroid Build Coastguard Worker 1794*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1795*58b9f456SAndroid Build Coastguard Workervoid 1796*58b9f456SAndroid Build Coastguard Workeratomic_flag_clear(atomic_flag* __o) _NOEXCEPT 1797*58b9f456SAndroid Build Coastguard Worker{ 1798*58b9f456SAndroid Build Coastguard Worker __o->clear(); 1799*58b9f456SAndroid Build Coastguard Worker} 1800*58b9f456SAndroid Build Coastguard Worker 1801*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1802*58b9f456SAndroid Build Coastguard Workervoid 1803*58b9f456SAndroid Build Coastguard Workeratomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT 1804*58b9f456SAndroid Build Coastguard Worker{ 1805*58b9f456SAndroid Build Coastguard Worker __o->clear(__m); 1806*58b9f456SAndroid Build Coastguard Worker} 1807*58b9f456SAndroid Build Coastguard Worker 1808*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1809*58b9f456SAndroid Build Coastguard Workervoid 1810*58b9f456SAndroid Build Coastguard Workeratomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT 1811*58b9f456SAndroid Build Coastguard Worker{ 1812*58b9f456SAndroid Build Coastguard Worker __o->clear(__m); 1813*58b9f456SAndroid Build Coastguard Worker} 1814*58b9f456SAndroid Build Coastguard Worker 1815*58b9f456SAndroid Build Coastguard Worker// fences 1816*58b9f456SAndroid Build Coastguard Worker 1817*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1818*58b9f456SAndroid Build Coastguard Workervoid 1819*58b9f456SAndroid Build Coastguard Workeratomic_thread_fence(memory_order __m) _NOEXCEPT 1820*58b9f456SAndroid Build Coastguard Worker{ 1821*58b9f456SAndroid Build Coastguard Worker __c11_atomic_thread_fence(__m); 1822*58b9f456SAndroid Build Coastguard Worker} 1823*58b9f456SAndroid Build Coastguard Worker 1824*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 1825*58b9f456SAndroid Build Coastguard Workervoid 1826*58b9f456SAndroid Build Coastguard Workeratomic_signal_fence(memory_order __m) _NOEXCEPT 1827*58b9f456SAndroid Build Coastguard Worker{ 1828*58b9f456SAndroid Build Coastguard Worker __c11_atomic_signal_fence(__m); 1829*58b9f456SAndroid Build Coastguard Worker} 1830*58b9f456SAndroid Build Coastguard Worker 1831*58b9f456SAndroid Build Coastguard Worker// Atomics for standard typedef types 1832*58b9f456SAndroid Build Coastguard Worker 1833*58b9f456SAndroid Build Coastguard Workertypedef atomic<bool> atomic_bool; 1834*58b9f456SAndroid Build Coastguard Workertypedef atomic<char> atomic_char; 1835*58b9f456SAndroid Build Coastguard Workertypedef atomic<signed char> atomic_schar; 1836*58b9f456SAndroid Build Coastguard Workertypedef atomic<unsigned char> atomic_uchar; 1837*58b9f456SAndroid Build Coastguard Workertypedef atomic<short> atomic_short; 1838*58b9f456SAndroid Build Coastguard Workertypedef atomic<unsigned short> atomic_ushort; 1839*58b9f456SAndroid Build Coastguard Workertypedef atomic<int> atomic_int; 1840*58b9f456SAndroid Build Coastguard Workertypedef atomic<unsigned int> atomic_uint; 1841*58b9f456SAndroid Build Coastguard Workertypedef atomic<long> atomic_long; 1842*58b9f456SAndroid Build Coastguard Workertypedef atomic<unsigned long> atomic_ulong; 1843*58b9f456SAndroid Build Coastguard Workertypedef atomic<long long> atomic_llong; 1844*58b9f456SAndroid Build Coastguard Workertypedef atomic<unsigned long long> atomic_ullong; 1845*58b9f456SAndroid Build Coastguard Workertypedef atomic<char16_t> atomic_char16_t; 1846*58b9f456SAndroid Build Coastguard Workertypedef atomic<char32_t> atomic_char32_t; 1847*58b9f456SAndroid Build Coastguard Workertypedef atomic<wchar_t> atomic_wchar_t; 1848*58b9f456SAndroid Build Coastguard Worker 1849*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_least8_t> atomic_int_least8_t; 1850*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_least8_t> atomic_uint_least8_t; 1851*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_least16_t> atomic_int_least16_t; 1852*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_least16_t> atomic_uint_least16_t; 1853*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_least32_t> atomic_int_least32_t; 1854*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_least32_t> atomic_uint_least32_t; 1855*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_least64_t> atomic_int_least64_t; 1856*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_least64_t> atomic_uint_least64_t; 1857*58b9f456SAndroid Build Coastguard Worker 1858*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_fast8_t> atomic_int_fast8_t; 1859*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_fast8_t> atomic_uint_fast8_t; 1860*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_fast16_t> atomic_int_fast16_t; 1861*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_fast16_t> atomic_uint_fast16_t; 1862*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_fast32_t> atomic_int_fast32_t; 1863*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_fast32_t> atomic_uint_fast32_t; 1864*58b9f456SAndroid Build Coastguard Workertypedef atomic<int_fast64_t> atomic_int_fast64_t; 1865*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint_fast64_t> atomic_uint_fast64_t; 1866*58b9f456SAndroid Build Coastguard Worker 1867*58b9f456SAndroid Build Coastguard Workertypedef atomic< int8_t> atomic_int8_t; 1868*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint8_t> atomic_uint8_t; 1869*58b9f456SAndroid Build Coastguard Workertypedef atomic< int16_t> atomic_int16_t; 1870*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint16_t> atomic_uint16_t; 1871*58b9f456SAndroid Build Coastguard Workertypedef atomic< int32_t> atomic_int32_t; 1872*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint32_t> atomic_uint32_t; 1873*58b9f456SAndroid Build Coastguard Workertypedef atomic< int64_t> atomic_int64_t; 1874*58b9f456SAndroid Build Coastguard Workertypedef atomic<uint64_t> atomic_uint64_t; 1875*58b9f456SAndroid Build Coastguard Worker 1876*58b9f456SAndroid Build Coastguard Workertypedef atomic<intptr_t> atomic_intptr_t; 1877*58b9f456SAndroid Build Coastguard Workertypedef atomic<uintptr_t> atomic_uintptr_t; 1878*58b9f456SAndroid Build Coastguard Workertypedef atomic<size_t> atomic_size_t; 1879*58b9f456SAndroid Build Coastguard Workertypedef atomic<ptrdiff_t> atomic_ptrdiff_t; 1880*58b9f456SAndroid Build Coastguard Workertypedef atomic<intmax_t> atomic_intmax_t; 1881*58b9f456SAndroid Build Coastguard Workertypedef atomic<uintmax_t> atomic_uintmax_t; 1882*58b9f456SAndroid Build Coastguard Worker 1883*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_FLAG_INIT {false} 1884*58b9f456SAndroid Build Coastguard Worker#define ATOMIC_VAR_INIT(__v) {__v} 1885*58b9f456SAndroid Build Coastguard Worker 1886*58b9f456SAndroid Build Coastguard Worker_LIBCPP_END_NAMESPACE_STD 1887*58b9f456SAndroid Build Coastguard Worker 1888*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_ATOMIC 1889