2010-09-27 23:17:38 +02:00
|
|
|
// -*- C++ -*-
|
|
|
|
//===--------------------------- atomic -----------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef _LIBCPP_ATOMIC
|
|
|
|
#define _LIBCPP_ATOMIC
|
|
|
|
|
|
|
|
/*
|
|
|
|
atomic synopsis
|
|
|
|
|
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
|
|
|
|
// order and consistency
|
|
|
|
|
|
|
|
typedef enum memory_order
|
|
|
|
{
|
2010-09-28 19:13:38 +02:00
|
|
|
memory_order_relaxed,
|
|
|
|
memory_order_consume, // load-consume
|
|
|
|
memory_order_acquire, // load-acquire
|
|
|
|
memory_order_release, // store-release
|
|
|
|
memory_order_acq_rel, // store-release load-acquire
|
|
|
|
memory_order_seq_cst // store-release load-acquire
|
2010-09-27 23:17:38 +02:00
|
|
|
} memory_order;
|
|
|
|
|
|
|
|
template <class T> T kill_dependency(T y);
|
|
|
|
|
|
|
|
// lock-free property
|
|
|
|
|
|
|
|
#define ATOMIC_CHAR_LOCK_FREE unspecified
|
|
|
|
#define ATOMIC_CHAR16_T_LOCK_FREE unspecified
|
|
|
|
#define ATOMIC_CHAR32_T_LOCK_FREE unspecified
|
|
|
|
#define ATOMIC_WCHAR_T_LOCK_FREE unspecified
|
|
|
|
#define ATOMIC_SHORT_LOCK_FREE unspecified
|
|
|
|
#define ATOMIC_INT_LOCK_FREE unspecified
|
|
|
|
#define ATOMIC_LONG_LOCK_FREE unspecified
|
|
|
|
#define ATOMIC_LLONG_LOCK_FREE unspecified
|
|
|
|
|
|
|
|
// flag type and operations
|
|
|
|
|
|
|
|
typedef struct atomic_flag
|
|
|
|
{
|
2010-12-07 00:10:08 +01:00
|
|
|
bool test_and_set(memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
bool test_and_set(memory_order m = memory_order_seq_cst);
|
|
|
|
void clear(memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
void clear(memory_order m = memory_order_seq_cst);
|
2010-09-27 23:17:38 +02:00
|
|
|
atomic_flag() = default;
|
|
|
|
atomic_flag(const atomic_flag&) = delete;
|
|
|
|
atomic_flag& operator=(const atomic_flag&) = delete;
|
|
|
|
atomic_flag& operator=(const atomic_flag&) volatile = delete;
|
|
|
|
} atomic_flag;
|
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
bool
|
|
|
|
atomic_flag_test_and_set(volatile atomic_flag* obj);
|
|
|
|
|
|
|
|
bool
|
|
|
|
atomic_flag_test_and_set(atomic_flag* obj);
|
|
|
|
|
|
|
|
bool
|
|
|
|
atomic_flag_test_and_set_explicit(volatile atomic_flag* obj,
|
|
|
|
memory_order m);
|
|
|
|
|
|
|
|
bool
|
|
|
|
atomic_flag_test_and_set_explicit(atomic_flag* obj, memory_order m);
|
|
|
|
|
|
|
|
void
|
|
|
|
atomic_flag_clear(volatile atomic_flag* obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
atomic_flag_clear(atomic_flag* obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
atomic_flag_clear_explicit(volatile atomic_flag* obj, memory_order m);
|
|
|
|
|
|
|
|
void
|
|
|
|
atomic_flag_clear_explicit(atomic_flag* obj, memory_order m);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
|
|
|
#define ATOMIC_FLAG_INIT see below
|
2010-10-19 18:51:18 +02:00
|
|
|
#define ATOMIC_VAR_INIT(value) see below
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
struct atomic
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
|
|
|
bool is_lock_free() const volatile;
|
|
|
|
bool is_lock_free() const;
|
2010-12-07 00:10:08 +01:00
|
|
|
void store(T desr, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
void store(T desr, memory_order m = memory_order_seq_cst);
|
|
|
|
T load(memory_order m = memory_order_seq_cst) const volatile;
|
|
|
|
T load(memory_order m = memory_order_seq_cst) const;
|
|
|
|
operator T() const volatile;
|
|
|
|
operator T() const;
|
|
|
|
T exchange(T desr, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
T exchange(T desr, memory_order m = memory_order_seq_cst);
|
|
|
|
bool compare_exchange_weak(T& expc, T desr,
|
|
|
|
memory_order s, memory_order f) volatile;
|
|
|
|
bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f);
|
|
|
|
bool compare_exchange_strong(T& expc, T desr,
|
|
|
|
memory_order s, memory_order f) volatile;
|
|
|
|
bool compare_exchange_strong(T& expc, T desr,
|
|
|
|
memory_order s, memory_order f);
|
|
|
|
bool compare_exchange_weak(T& expc, T desr,
|
|
|
|
memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
bool compare_exchange_weak(T& expc, T desr,
|
|
|
|
memory_order m = memory_order_seq_cst);
|
|
|
|
bool compare_exchange_strong(T& expc, T desr,
|
|
|
|
memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
bool compare_exchange_strong(T& expc, T desr,
|
|
|
|
memory_order m = memory_order_seq_cst);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
atomic() = default;
|
|
|
|
constexpr atomic(T desr);
|
|
|
|
atomic(const atomic&) = delete;
|
|
|
|
atomic& operator=(const atomic&) = delete;
|
|
|
|
atomic& operator=(const atomic&) volatile = delete;
|
|
|
|
T operator=(T) volatile;
|
|
|
|
T operator=(T);
|
|
|
|
};
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <>
|
|
|
|
struct atomic<integral>
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
|
|
|
bool is_lock_free() const volatile;
|
|
|
|
bool is_lock_free() const;
|
2010-12-07 00:10:08 +01:00
|
|
|
void store(integral desr, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
void store(integral desr, memory_order m = memory_order_seq_cst);
|
|
|
|
integral load(memory_order m = memory_order_seq_cst) const volatile;
|
|
|
|
integral load(memory_order m = memory_order_seq_cst) const;
|
|
|
|
operator integral() const volatile;
|
|
|
|
operator integral() const;
|
|
|
|
integral exchange(integral desr,
|
|
|
|
memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
integral exchange(integral desr, memory_order m = memory_order_seq_cst);
|
|
|
|
bool compare_exchange_weak(integral& expc, integral desr,
|
|
|
|
memory_order s, memory_order f) volatile;
|
|
|
|
bool compare_exchange_weak(integral& expc, integral desr,
|
|
|
|
memory_order s, memory_order f);
|
|
|
|
bool compare_exchange_strong(integral& expc, integral desr,
|
|
|
|
memory_order s, memory_order f) volatile;
|
|
|
|
bool compare_exchange_strong(integral& expc, integral desr,
|
|
|
|
memory_order s, memory_order f);
|
|
|
|
bool compare_exchange_weak(integral& expc, integral desr,
|
|
|
|
memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
bool compare_exchange_weak(integral& expc, integral desr,
|
|
|
|
memory_order m = memory_order_seq_cst);
|
|
|
|
bool compare_exchange_strong(integral& expc, integral desr,
|
|
|
|
memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
bool compare_exchange_strong(integral& expc, integral desr,
|
|
|
|
memory_order m = memory_order_seq_cst);
|
|
|
|
|
|
|
|
integral
|
|
|
|
fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
integral fetch_add(integral op, memory_order m = memory_order_seq_cst);
|
|
|
|
integral
|
|
|
|
fetch_sub(integral op, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
integral fetch_sub(integral op, memory_order m = memory_order_seq_cst);
|
|
|
|
integral
|
|
|
|
fetch_and(integral op, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
integral fetch_and(integral op, memory_order m = memory_order_seq_cst);
|
|
|
|
integral
|
|
|
|
fetch_or(integral op, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
integral fetch_or(integral op, memory_order m = memory_order_seq_cst);
|
|
|
|
integral
|
|
|
|
fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
integral fetch_xor(integral op, memory_order m = memory_order_seq_cst);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
atomic() = default;
|
|
|
|
constexpr atomic(integral desr);
|
|
|
|
atomic(const atomic&) = delete;
|
|
|
|
atomic& operator=(const atomic&) = delete;
|
|
|
|
atomic& operator=(const atomic&) volatile = delete;
|
|
|
|
integral operator=(integral desr) volatile;
|
|
|
|
integral operator=(integral desr);
|
|
|
|
|
|
|
|
integral operator++(int) volatile;
|
|
|
|
integral operator++(int);
|
|
|
|
integral operator--(int) volatile;
|
|
|
|
integral operator--(int);
|
|
|
|
integral operator++() volatile;
|
|
|
|
integral operator++();
|
|
|
|
integral operator--() volatile;
|
|
|
|
integral operator--();
|
|
|
|
integral operator+=(integral op) volatile;
|
|
|
|
integral operator+=(integral op);
|
|
|
|
integral operator-=(integral op) volatile;
|
|
|
|
integral operator-=(integral op);
|
|
|
|
integral operator&=(integral op) volatile;
|
|
|
|
integral operator&=(integral op);
|
|
|
|
integral operator|=(integral op) volatile;
|
|
|
|
integral operator|=(integral op);
|
2010-12-07 21:46:14 +01:00
|
|
|
integral operator^=(integral op) volatile;
|
|
|
|
integral operator^=(integral op);
|
2010-12-07 00:10:08 +01:00
|
|
|
};
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
struct atomic<T*>
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
|
|
|
bool is_lock_free() const volatile;
|
|
|
|
bool is_lock_free() const;
|
2010-12-07 00:10:08 +01:00
|
|
|
void store(T* desr, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
void store(T* desr, memory_order m = memory_order_seq_cst);
|
|
|
|
T* load(memory_order m = memory_order_seq_cst) const volatile;
|
|
|
|
T* load(memory_order m = memory_order_seq_cst) const;
|
|
|
|
operator T*() const volatile;
|
|
|
|
operator T*() const;
|
|
|
|
T* exchange(T* desr, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
T* exchange(T* desr, memory_order m = memory_order_seq_cst);
|
|
|
|
bool compare_exchange_weak(T*& expc, T* desr,
|
|
|
|
memory_order s, memory_order f) volatile;
|
|
|
|
bool compare_exchange_weak(T*& expc, T* desr,
|
|
|
|
memory_order s, memory_order f);
|
|
|
|
bool compare_exchange_strong(T*& expc, T* desr,
|
|
|
|
memory_order s, memory_order f) volatile;
|
|
|
|
bool compare_exchange_strong(T*& expc, T* desr,
|
|
|
|
memory_order s, memory_order f);
|
|
|
|
bool compare_exchange_weak(T*& expc, T* desr,
|
|
|
|
memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
bool compare_exchange_weak(T*& expc, T* desr,
|
|
|
|
memory_order m = memory_order_seq_cst);
|
|
|
|
bool compare_exchange_strong(T*& expc, T* desr,
|
|
|
|
memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
bool compare_exchange_strong(T*& expc, T* desr,
|
|
|
|
memory_order m = memory_order_seq_cst);
|
|
|
|
T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst);
|
|
|
|
T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile;
|
|
|
|
T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
atomic() = default;
|
|
|
|
constexpr atomic(T* desr);
|
|
|
|
atomic(const atomic&) = delete;
|
|
|
|
atomic& operator=(const atomic&) = delete;
|
|
|
|
atomic& operator=(const atomic&) volatile = delete;
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
T* operator=(T*) volatile;
|
|
|
|
T* operator=(T*);
|
|
|
|
T* operator++(int) volatile;
|
|
|
|
T* operator++(int);
|
|
|
|
T* operator--(int) volatile;
|
|
|
|
T* operator--(int);
|
|
|
|
T* operator++() volatile;
|
|
|
|
T* operator++();
|
|
|
|
T* operator--() volatile;
|
|
|
|
T* operator--();
|
|
|
|
T* operator+=(ptrdiff_t op) volatile;
|
|
|
|
T* operator+=(ptrdiff_t op);
|
|
|
|
T* operator-=(ptrdiff_t op) volatile;
|
|
|
|
T* operator-=(ptrdiff_t op);
|
|
|
|
};
|
2010-09-27 23:17:38 +02:00
|
|
|
|
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
bool
|
|
|
|
atomic_is_lock_free(const volatile atomic<T>* obj);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
bool
|
|
|
|
atomic_is_lock_free(const atomic<T>* obj);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
void
|
|
|
|
atomic_init(volatile atomic<T>* obj, T desr);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
void
|
|
|
|
atomic_init(atomic<T>* obj, T desr);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
void
|
|
|
|
atomic_store(volatile atomic<T>* obj, T desr);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
void
|
|
|
|
atomic_store(atomic<T>* obj, T desr);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
void
|
|
|
|
atomic_store_explicit(volatile atomic<T>* obj, T desr, memory_order m);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
void
|
|
|
|
atomic_store_explicit(atomic<T>* obj, T desr, memory_order m);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
T
|
|
|
|
atomic_load(const volatile atomic<T>* obj);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
T
|
|
|
|
atomic_load(const atomic<T>* obj);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
T
|
|
|
|
atomic_load_explicit(const volatile atomic<T>* obj, memory_order m);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
T
|
|
|
|
atomic_load_explicit(const atomic<T>* obj, memory_order m);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
T
|
|
|
|
atomic_exchange(volatile atomic<T>* obj, T desr);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
T
|
|
|
|
atomic_exchange(atomic<T>* obj, T desr);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
T
|
|
|
|
atomic_exchange_explicit(volatile atomic<T>* obj, T desr, memory_order m);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
T
|
|
|
|
atomic_exchange_explicit(atomic<T>* obj, T desr, memory_order m);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_weak(volatile atomic<T>* obj, T* expc, T desr);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_weak(atomic<T>* obj, T* expc, T desr);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_strong(volatile atomic<T>* obj, T* expc, T desr);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_strong(atomic<T>* obj, T* expc, T desr);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_weak_explicit(volatile atomic<T>* obj, T* expc,
|
|
|
|
T desr,
|
|
|
|
memory_order s, memory_order f);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_weak_explicit(atomic<T>* obj, T* expc, T desr,
|
|
|
|
memory_order s, memory_order f);
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class T>
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_strong_explicit(volatile atomic<T>* obj,
|
|
|
|
T* expc, T desr,
|
|
|
|
memory_order s, memory_order f);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_strong_explicit(atomic<T>* obj, T* expc,
|
|
|
|
T desr,
|
|
|
|
memory_order s, memory_order f);
|
|
|
|
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_add(volatile atomic<Integral>* obj, Integral op);
|
|
|
|
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_add(atomic<Integral>* obj, Integral op);
|
|
|
|
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_add_explicit(volatile atomic<Integral>* obj, Integral op,
|
|
|
|
memory_order m);
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_add_explicit(atomic<Integral>* obj, Integral op,
|
|
|
|
memory_order m);
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_sub(volatile atomic<Integral>* obj, Integral op);
|
|
|
|
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_sub(atomic<Integral>* obj, Integral op);
|
|
|
|
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_sub_explicit(volatile atomic<Integral>* obj, Integral op,
|
|
|
|
memory_order m);
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_sub_explicit(atomic<Integral>* obj, Integral op,
|
|
|
|
memory_order m);
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_and(volatile atomic<Integral>* obj, Integral op);
|
|
|
|
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_and(atomic<Integral>* obj, Integral op);
|
|
|
|
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_and_explicit(volatile atomic<Integral>* obj, Integral op,
|
|
|
|
memory_order m);
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_and_explicit(atomic<Integral>* obj, Integral op,
|
|
|
|
memory_order m);
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_or(volatile atomic<Integral>* obj, Integral op);
|
|
|
|
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_or(atomic<Integral>* obj, Integral op);
|
|
|
|
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_or_explicit(volatile atomic<Integral>* obj, Integral op,
|
|
|
|
memory_order m);
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_or_explicit(atomic<Integral>* obj, Integral op,
|
|
|
|
memory_order m);
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_xor(volatile atomic<Integral>* obj, Integral op);
|
|
|
|
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_xor(atomic<Integral>* obj, Integral op);
|
|
|
|
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_xor_explicit(volatile atomic<Integral>* obj, Integral op,
|
|
|
|
memory_order m);
|
|
|
|
template <class Integral>
|
|
|
|
Integral
|
|
|
|
atomic_fetch_xor_explicit(atomic<Integral>* obj, Integral op,
|
|
|
|
memory_order m);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
T*
|
|
|
|
atomic_fetch_add(volatile atomic<T*>* obj, ptrdiff_t op);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
T*
|
|
|
|
atomic_fetch_add(atomic<T*>* obj, ptrdiff_t op);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
T*
|
|
|
|
atomic_fetch_add_explicit(volatile atomic<T*>* obj, ptrdiff_t op,
|
|
|
|
memory_order m);
|
|
|
|
template <class T>
|
|
|
|
T*
|
|
|
|
atomic_fetch_add_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
T*
|
|
|
|
atomic_fetch_sub(volatile atomic<T*>* obj, ptrdiff_t op);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
T*
|
|
|
|
atomic_fetch_sub(atomic<T*>* obj, ptrdiff_t op);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
T*
|
|
|
|
atomic_fetch_sub_explicit(volatile atomic<T*>* obj, ptrdiff_t op,
|
|
|
|
memory_order m);
|
|
|
|
template <class T>
|
|
|
|
T*
|
|
|
|
atomic_fetch_sub_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m);
|
|
|
|
|
|
|
|
// Atomics for standard typedef types
|
|
|
|
|
|
|
|
typedef atomic<char> atomic_char;
|
|
|
|
typedef atomic<signed char> atomic_schar;
|
|
|
|
typedef atomic<unsigned char> atomic_uchar;
|
|
|
|
typedef atomic<short> atomic_short;
|
|
|
|
typedef atomic<unsigned short> atomic_ushort;
|
|
|
|
typedef atomic<int> atomic_int;
|
|
|
|
typedef atomic<unsigned int> atomic_uint;
|
|
|
|
typedef atomic<long> atomic_long;
|
|
|
|
typedef atomic<unsigned long> atomic_ulong;
|
|
|
|
typedef atomic<long long> atomic_llong;
|
|
|
|
typedef atomic<unsigned long long> atomic_ullong;
|
|
|
|
typedef atomic<char16_t> atomic_char16_t;
|
|
|
|
typedef atomic<char32_t> atomic_char32_t;
|
|
|
|
typedef atomic<wchar_t> atomic_wchar_t;
|
|
|
|
|
|
|
|
typedef atomic<int_least8_t> atomic_int_least8_t;
|
|
|
|
typedef atomic<uint_least8_t> atomic_uint_least8_t;
|
|
|
|
typedef atomic<int_least16_t> atomic_int_least16_t;
|
|
|
|
typedef atomic<uint_least16_t> atomic_uint_least16_t;
|
|
|
|
typedef atomic<int_least32_t> atomic_int_least32_t;
|
|
|
|
typedef atomic<uint_least32_t> atomic_uint_least32_t;
|
|
|
|
typedef atomic<int_least64_t> atomic_int_least64_t;
|
|
|
|
typedef atomic<uint_least64_t> atomic_uint_least64_t;
|
|
|
|
|
|
|
|
typedef atomic<int_fast8_t> atomic_int_fast8_t;
|
|
|
|
typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
|
|
|
|
typedef atomic<int_fast16_t> atomic_int_fast16_t;
|
|
|
|
typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
|
|
|
|
typedef atomic<int_fast32_t> atomic_int_fast32_t;
|
|
|
|
typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
|
|
|
|
typedef atomic<int_fast64_t> atomic_int_fast64_t;
|
|
|
|
typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
|
|
|
|
|
|
|
|
typedef atomic<intptr_t> atomic_intptr_t;
|
|
|
|
typedef atomic<uintptr_t> atomic_uintptr_t;
|
|
|
|
typedef atomic<size_t> atomic_size_t;
|
|
|
|
typedef atomic<ptrdiff_t> atomic_ptrdiff_t;
|
|
|
|
typedef atomic<intmax_t> atomic_intmax_t;
|
|
|
|
typedef atomic<uintmax_t> atomic_uintmax_t;
|
|
|
|
|
|
|
|
// fences
|
|
|
|
|
|
|
|
void atomic_thread_fence(memory_order m);
|
|
|
|
void atomic_signal_fence(memory_order m);
|
|
|
|
|
|
|
|
} // std
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <__config>
|
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <type_traits>
|
|
|
|
|
2011-10-17 22:05:10 +02:00
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
2010-12-07 00:10:08 +01:00
|
|
|
#pragma GCC system_header
|
2011-10-17 22:05:10 +02:00
|
|
|
#endif
|
2010-12-07 00:10:08 +01:00
|
|
|
|
|
|
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
|
|
|
2011-03-31 18:39:39 +02:00
|
|
|
#if !__has_feature(cxx_atomic)
|
|
|
|
#error <atomic> is not implemented
|
|
|
|
#else
|
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
typedef enum memory_order
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 00:10:08 +01:00
|
|
|
memory_order_relaxed, memory_order_consume, memory_order_acquire,
|
|
|
|
memory_order_release, memory_order_acq_rel, memory_order_seq_cst
|
|
|
|
} memory_order;
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp
|
|
|
|
kill_dependency(_Tp __y)
|
|
|
|
{
|
|
|
|
return __y;
|
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// general atomic<T>
|
|
|
|
|
|
|
|
template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
|
|
|
|
struct __atomic_base // false
|
|
|
|
{
|
2011-12-19 12:44:20 +01:00
|
|
|
_Atomic(_Tp) __a_;
|
2010-12-07 21:46:14 +01:00
|
|
|
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool is_lock_free() const volatile
|
|
|
|
{return __atomic_is_lock_free(_Tp());}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool is_lock_free() const
|
|
|
|
{return __atomic_is_lock_free(_Tp());}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile
|
|
|
|
{__atomic_store(&__a_, __d, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
void store(_Tp __d, memory_order __m = memory_order_seq_cst)
|
|
|
|
{__atomic_store(&__a_, __d, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp load(memory_order __m = memory_order_seq_cst) const volatile
|
|
|
|
{return __atomic_load(&__a_, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp load(memory_order __m = memory_order_seq_cst) const
|
|
|
|
{return __atomic_load(&__a_, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
operator _Tp() const volatile {return load();}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
operator _Tp() const {return load();}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile
|
|
|
|
{return __atomic_exchange(&__a_, __d, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst)
|
|
|
|
{return __atomic_exchange(&__a_, __d, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool compare_exchange_weak(_Tp& __e, _Tp __d,
|
|
|
|
memory_order __s, memory_order __f) volatile
|
|
|
|
{return __atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool compare_exchange_weak(_Tp& __e, _Tp __d,
|
|
|
|
memory_order __s, memory_order __f)
|
|
|
|
{return __atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool compare_exchange_strong(_Tp& __e, _Tp __d,
|
|
|
|
memory_order __s, memory_order __f) volatile
|
|
|
|
{return __atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool compare_exchange_strong(_Tp& __e, _Tp __d,
|
|
|
|
memory_order __s, memory_order __f)
|
|
|
|
{return __atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool compare_exchange_weak(_Tp& __e, _Tp __d,
|
|
|
|
memory_order __m = memory_order_seq_cst) volatile
|
|
|
|
{return __atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool compare_exchange_weak(_Tp& __e, _Tp __d,
|
|
|
|
memory_order __m = memory_order_seq_cst)
|
|
|
|
{return __atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool compare_exchange_strong(_Tp& __e, _Tp __d,
|
|
|
|
memory_order __m = memory_order_seq_cst) volatile
|
|
|
|
{return __atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool compare_exchange_strong(_Tp& __e, _Tp __d,
|
|
|
|
memory_order __m = memory_order_seq_cst)
|
|
|
|
{return __atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
|
|
|
|
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
__atomic_base() {} // = default;
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2011-12-19 12:44:20 +01:00
|
|
|
/*constexpr*/ __atomic_base(_Tp __d) { __atomic_store(&__a_, __d, memory_order_seq_cst); }
|
2010-12-08 18:20:28 +01:00
|
|
|
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
2010-12-07 21:46:14 +01:00
|
|
|
__atomic_base(const __atomic_base&) = delete;
|
|
|
|
__atomic_base& operator=(const __atomic_base&) = delete;
|
|
|
|
__atomic_base& operator=(const __atomic_base&) volatile = delete;
|
2010-12-08 18:20:28 +01:00
|
|
|
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
|
|
|
private:
|
|
|
|
__atomic_base(const __atomic_base&);
|
|
|
|
__atomic_base& operator=(const __atomic_base&);
|
|
|
|
__atomic_base& operator=(const __atomic_base&) volatile;
|
|
|
|
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
2010-12-07 21:46:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// atomic<Integral>
|
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
struct __atomic_base<_Tp, true>
|
|
|
|
: public __atomic_base<_Tp, false>
|
|
|
|
{
|
|
|
|
typedef __atomic_base<_Tp, false> __base;
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
__atomic_base() {} // = default;
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
/*constexpr*/ __atomic_base(_Tp __d) : __base(__d) {}
|
|
|
|
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile
|
|
|
|
{return __atomic_fetch_add(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst)
|
|
|
|
{return __atomic_fetch_add(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile
|
|
|
|
{return __atomic_fetch_sub(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst)
|
|
|
|
{return __atomic_fetch_sub(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile
|
|
|
|
{return __atomic_fetch_and(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst)
|
|
|
|
{return __atomic_fetch_and(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile
|
|
|
|
{return __atomic_fetch_or(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst)
|
|
|
|
{return __atomic_fetch_or(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile
|
|
|
|
{return __atomic_fetch_xor(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst)
|
|
|
|
{return __atomic_fetch_xor(&this->__a_, __op, __m);}
|
|
|
|
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator++(int) volatile {return fetch_add(_Tp(1));}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator++(int) {return fetch_add(_Tp(1));}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator--(int) volatile {return fetch_sub(_Tp(1));}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator--(int) {return fetch_sub(_Tp(1));}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator++() volatile {return fetch_add(_Tp(1)) + _Tp(1);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator++() {return fetch_add(_Tp(1)) + _Tp(1);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator--() volatile {return fetch_sub(_Tp(1)) - _Tp(1);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator--() {return fetch_sub(_Tp(1)) - _Tp(1);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator+=(_Tp __op) volatile {return fetch_add(__op) + __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator+=(_Tp __op) {return fetch_add(__op) + __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator-=(_Tp __op) volatile {return fetch_sub(__op) - __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator-=(_Tp __op) {return fetch_sub(__op) - __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator&=(_Tp __op) volatile {return fetch_and(__op) & __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator&=(_Tp __op) {return fetch_and(__op) & __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator|=(_Tp __op) volatile {return fetch_or(__op) | __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator|=(_Tp __op) {return fetch_or(__op) | __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator^=(_Tp __op) volatile {return fetch_xor(__op) ^ __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator^=(_Tp __op) {return fetch_xor(__op) ^ __op;}
|
|
|
|
};
|
|
|
|
|
|
|
|
// atomic<T>
|
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
struct atomic
|
|
|
|
: public __atomic_base<_Tp>
|
|
|
|
{
|
|
|
|
typedef __atomic_base<_Tp> __base;
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
atomic() {} // = default;
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
/*constexpr*/ atomic(_Tp __d) : __base(__d) {}
|
2010-12-08 00:24:41 +01:00
|
|
|
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator=(_Tp __d) volatile
|
|
|
|
{__base::store(__d); return __d;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp operator=(_Tp __d)
|
|
|
|
{__base::store(__d); return __d;}
|
2010-12-07 21:46:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// atomic<T*>
|
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
struct atomic<_Tp*>
|
|
|
|
: public __atomic_base<_Tp*>
|
|
|
|
{
|
2010-12-08 00:24:41 +01:00
|
|
|
typedef __atomic_base<_Tp*> __base;
|
2010-12-07 21:46:14 +01:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
atomic() {} // = default;
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
/*constexpr*/ atomic(_Tp* __d) : __base(__d) {}
|
|
|
|
|
2010-12-08 00:24:41 +01:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator=(_Tp* __d) volatile
|
|
|
|
{__base::store(__d); return __d;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator=(_Tp* __d)
|
|
|
|
{__base::store(__d); return __d;}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
|
|
|
|
volatile
|
|
|
|
{return __atomic_fetch_add(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
|
|
|
|
{return __atomic_fetch_add(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
|
|
|
|
volatile
|
|
|
|
{return __atomic_fetch_sub(&this->__a_, __op, __m);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
|
|
|
|
{return __atomic_fetch_sub(&this->__a_, __op, __m);}
|
|
|
|
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator++(int) volatile {return fetch_add(1);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator++(int) {return fetch_add(1);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator--(int) volatile {return fetch_sub(1);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator--(int) {return fetch_sub(1);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator++() volatile {return fetch_add(1) + 1;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator++() {return fetch_add(1) + 1;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator--() volatile {return fetch_sub(1) - 1;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator--() {return fetch_sub(1) - 1;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator+=(ptrdiff_t __op) volatile {return fetch_add(__op) + __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator+=(ptrdiff_t __op) {return fetch_add(__op) + __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator-=(ptrdiff_t __op) volatile {return fetch_sub(__op) - __op;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp* operator-=(ptrdiff_t __op) {return fetch_sub(__op) - __op;}
|
|
|
|
};
|
2010-12-07 00:10:08 +01:00
|
|
|
|
|
|
|
// atomic_is_lock_free
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool
|
2010-12-07 21:46:14 +01:00
|
|
|
atomic_is_lock_free(const volatile atomic<_Tp>* __o)
|
2010-12-07 00:10:08 +01:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->is_lock_free();
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool
|
2010-12-07 21:46:14 +01:00
|
|
|
atomic_is_lock_free(const atomic<_Tp>* __o)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->is_lock_free();
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
// atomic_init
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
void
|
|
|
|
atomic_init(volatile atomic<_Tp>* __o, _Tp __d)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2011-12-19 12:44:20 +01:00
|
|
|
__atomic_store(&__o->__a_, __d, memory_order_seq_cst);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
void
|
|
|
|
atomic_init(atomic<_Tp>* __o, _Tp __d)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2011-12-19 12:44:20 +01:00
|
|
|
__atomic_store(&__o->__a_, __d, memory_order_seq_cst);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
// atomic_store
|
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
void
|
|
|
|
atomic_store(volatile atomic<_Tp>* __o, _Tp __d)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
__o->store(__d);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
void
|
|
|
|
atomic_store(atomic<_Tp>* __o, _Tp __d)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
__o->store(__d);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
// atomic_store_explicit
|
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
void
|
|
|
|
atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
__o->store(__d, __m);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
void
|
|
|
|
atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
__o->store(__d, __m);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
// atomic_load
|
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp
|
|
|
|
atomic_load(const volatile atomic<_Tp>* __o)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->load();
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp
|
|
|
|
atomic_load(const atomic<_Tp>* __o)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->load();
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
// atomic_load_explicit
|
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp
|
|
|
|
atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->load(__m);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp
|
|
|
|
atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->load(__m);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
// atomic_exchange
|
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp
|
|
|
|
atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->exchange(__d);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp
|
|
|
|
atomic_exchange(atomic<_Tp>* __o, _Tp __d)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->exchange(__d);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
// atomic_exchange_explicit
|
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp
|
|
|
|
atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->exchange(__d, __m);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp
|
|
|
|
atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->exchange(__d, __m);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
// atomic_compare_exchange_weak
|
|
|
|
|
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->compare_exchange_weak(*__e, __d);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d)
|
2010-09-27 23:17:38 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->compare_exchange_weak(*__e, __d);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
// atomic_compare_exchange_strong
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d)
|
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->compare_exchange_strong(*__e, __d);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d)
|
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->compare_exchange_strong(*__e, __d);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
// atomic_compare_exchange_weak_explicit
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
|
|
|
|
_Tp __d,
|
|
|
|
memory_order __s, memory_order __f)
|
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->compare_exchange_weak(*__e, __d, __s, __f);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
|
|
|
|
memory_order __s, memory_order __f)
|
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->compare_exchange_weak(*__e, __d, __s, __f);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-27 23:17:38 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
// atomic_compare_exchange_strong_explicit
|
2010-10-04 20:52:54 +02:00
|
|
|
|
2010-12-07 00:10:08 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool
|
|
|
|
atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
|
|
|
|
_Tp* __e, _Tp __d,
|
|
|
|
memory_order __s, memory_order __f)
|
2010-10-04 20:52:54 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->compare_exchange_strong(*__e, __d, __s, __f);
|
2010-12-07 00:10:08 +01:00
|
|
|
}
|
2010-09-29 23:20:03 +02:00
|
|
|
|
2010-10-04 20:52:54 +02:00
|
|
|
template <class _Tp>
|
2010-09-29 23:20:03 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 00:10:08 +01:00
|
|
|
bool
|
|
|
|
atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
|
|
|
|
_Tp __d,
|
|
|
|
memory_order __s, memory_order __f)
|
2010-10-04 20:52:54 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->compare_exchange_strong(*__e, __d, __s, __f);
|
2010-10-04 20:52:54 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// atomic_fetch_add
|
2010-12-07 00:10:08 +01:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op)
|
|
|
|
{
|
|
|
|
return __o->fetch_add(__op);
|
|
|
|
}
|
2010-12-07 00:10:08 +01:00
|
|
|
|
|
|
|
template <class _Tp>
|
2010-12-07 21:46:14 +01:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_add(atomic<_Tp>* __o, _Tp __op)
|
2010-12-07 00:10:08 +01:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_add(__op);
|
|
|
|
}
|
2010-12-07 00:10:08 +01:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp*
|
|
|
|
atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op)
|
|
|
|
{
|
|
|
|
return __o->fetch_add(__op);
|
|
|
|
}
|
2010-12-07 00:10:08 +01:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp*
|
|
|
|
atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op)
|
|
|
|
{
|
|
|
|
return __o->fetch_add(__op);
|
|
|
|
}
|
2010-12-07 00:10:08 +01:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// atomic_fetch_add_explicit
|
2010-09-29 20:13:54 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
|
|
|
|
{
|
|
|
|
return __o->fetch_add(__op, __m);
|
|
|
|
}
|
2010-10-05 16:02:23 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m)
|
|
|
|
{
|
|
|
|
return __o->fetch_add(__op, __m);
|
|
|
|
}
|
2010-09-29 20:13:54 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp*
|
|
|
|
atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
|
|
|
|
memory_order __m)
|
|
|
|
{
|
|
|
|
return __o->fetch_add(__op, __m);
|
|
|
|
}
|
2010-09-29 23:20:03 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
_Tp*
|
|
|
|
atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m)
|
2010-09-29 20:13:54 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_add(__op, __m);
|
|
|
|
}
|
2010-09-29 20:13:54 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// atomic_fetch_sub
|
2010-09-29 23:20:03 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op)
|
|
|
|
{
|
|
|
|
return __o->fetch_sub(__op);
|
|
|
|
}
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_sub(__op);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
_Tp*
|
|
|
|
atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_sub(__op);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
_Tp*
|
|
|
|
atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_sub(__op);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// atomic_fetch_sub_explicit
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_sub(__op, __m);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_sub(__op, __m);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
_Tp*
|
|
|
|
atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
|
|
|
|
memory_order __m)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_sub(__op, __m);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
_Tp*
|
|
|
|
atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_sub(__op, __m);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// atomic_fetch_and
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_and(__op);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_and(atomic<_Tp>* __o, _Tp __op)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_and(__op);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// atomic_fetch_and_explicit
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_and(__op, __m);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_and(__op, __m);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// atomic_fetch_or
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_or(__op);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_or(atomic<_Tp>* __o, _Tp __op)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_or(__op);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// atomic_fetch_or_explicit
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_or(__op, __m);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_or(__op, __m);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// atomic_fetch_xor
|
|
|
|
|
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_xor(__op);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_xor(__op);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// atomic_fetch_xor_explicit
|
|
|
|
|
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_xor(__op, __m);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
template <class _Tp>
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
typename enable_if
|
|
|
|
<
|
|
|
|
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
|
|
|
_Tp
|
|
|
|
>::type
|
|
|
|
atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m)
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
{
|
2010-12-07 21:46:14 +01:00
|
|
|
return __o->fetch_xor(__op, __m);
|
atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 23:22:10 +02:00
|
|
|
}
|
|
|
|
|
2010-12-07 21:46:14 +01:00
|
|
|
// flag type and operations
|
|
|
|
|
2010-12-08 18:20:28 +01:00
|
|
|
typedef struct atomic_flag
|
2010-10-21 19:44:19 +02:00
|
|
|
{
|
2011-12-19 12:44:20 +01:00
|
|
|
_Atomic(bool) __a_;
|
2010-10-21 19:44:19 +02:00
|
|
|
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-12-08 18:20:28 +01:00
|
|
|
bool test_and_set(memory_order __m = memory_order_seq_cst) volatile
|
|
|
|
{return __atomic_exchange(&__a_, true, __m);}
|
2010-10-21 19:44:19 +02:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-12-08 18:20:28 +01:00
|
|
|
bool test_and_set(memory_order __m = memory_order_seq_cst)
|
|
|
|
{return __atomic_exchange(&__a_, true, __m);}
|
2010-10-21 19:44:19 +02:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-12-08 18:20:28 +01:00
|
|
|
void clear(memory_order __m = memory_order_seq_cst) volatile
|
|
|
|
{__atomic_store(&__a_, false, __m);}
|
2010-10-21 19:44:19 +02:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-12-08 18:20:28 +01:00
|
|
|
void clear(memory_order __m = memory_order_seq_cst)
|
|
|
|
{__atomic_store(&__a_, false, __m);}
|
2010-12-07 21:46:14 +01:00
|
|
|
|
2010-10-21 19:44:19 +02:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-12-08 18:20:28 +01:00
|
|
|
atomic_flag() {} // = default;
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2011-12-19 12:44:20 +01:00
|
|
|
atomic_flag(bool __b) { __atomic_store(&__a_, __b, memory_order_seq_cst); }
|
2010-12-07 21:46:14 +01:00
|
|
|
|
2010-10-21 19:44:19 +02:00
|
|
|
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
2010-12-07 21:46:14 +01:00
|
|
|
atomic_flag(const atomic_flag&) = delete;
|
|
|
|
atomic_flag& operator=(const atomic_flag&) = delete;
|
|
|
|
atomic_flag& operator=(const atomic_flag&) volatile = delete;
|
2010-12-08 18:20:28 +01:00
|
|
|
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
2010-10-21 19:44:19 +02:00
|
|
|
private:
|
2010-12-07 21:46:14 +01:00
|
|
|
atomic_flag(const atomic_flag&);
|
|
|
|
atomic_flag& operator=(const atomic_flag&);
|
|
|
|
atomic_flag& operator=(const atomic_flag&) volatile;
|
2010-12-08 18:20:28 +01:00
|
|
|
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
2010-12-07 21:46:14 +01:00
|
|
|
} atomic_flag;
|
2010-10-21 19:44:19 +02:00
|
|
|
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool
|
2010-12-08 18:20:28 +01:00
|
|
|
atomic_flag_test_and_set(volatile atomic_flag* __o)
|
2010-10-21 19:44:19 +02:00
|
|
|
{
|
2010-12-08 18:20:28 +01:00
|
|
|
return __o->test_and_set();
|
2010-10-21 19:44:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
bool
|
2010-12-08 18:20:28 +01:00
|
|
|
atomic_flag_test_and_set(atomic_flag* __o)
|
2010-10-21 19:44:19 +02:00
|
|
|
{
|
2010-12-08 18:20:28 +01:00
|
|
|
return __o->test_and_set();
|
2010-10-21 19:44:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
bool
|
2010-12-08 18:20:28 +01:00
|
|
|
atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m)
|
2010-10-21 19:44:19 +02:00
|
|
|
{
|
2010-12-08 18:20:28 +01:00
|
|
|
return __o->test_and_set(__m);
|
2010-10-21 19:44:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-07 21:46:14 +01:00
|
|
|
bool
|
2010-12-08 18:20:28 +01:00
|
|
|
atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m)
|
2010-10-21 19:44:19 +02:00
|
|
|
{
|
2010-12-08 18:20:28 +01:00
|
|
|
return __o->test_and_set(__m);
|
2010-10-21 19:44:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
void
|
2010-12-08 18:20:28 +01:00
|
|
|
atomic_flag_clear(volatile atomic_flag* __o)
|
2010-10-21 19:44:19 +02:00
|
|
|
{
|
2010-12-08 18:20:28 +01:00
|
|
|
__o->clear();
|
2010-10-21 19:44:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
void
|
2010-12-08 18:20:28 +01:00
|
|
|
atomic_flag_clear(atomic_flag* __o)
|
2010-10-21 19:44:19 +02:00
|
|
|
{
|
2010-12-08 18:20:28 +01:00
|
|
|
__o->clear();
|
2010-10-21 19:44:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
void
|
2010-12-08 18:20:28 +01:00
|
|
|
atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m)
|
2010-10-21 19:44:19 +02:00
|
|
|
{
|
2010-12-08 18:20:28 +01:00
|
|
|
__o->clear(__m);
|
2010-10-21 19:44:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
void
|
2010-12-08 18:20:28 +01:00
|
|
|
atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m)
|
2010-10-21 19:44:19 +02:00
|
|
|
{
|
2010-12-08 18:20:28 +01:00
|
|
|
__o->clear(__m);
|
2010-10-21 19:44:19 +02:00
|
|
|
}
|
|
|
|
|
2010-12-08 18:20:28 +01:00
|
|
|
// fences
|
2010-10-21 19:44:19 +02:00
|
|
|
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2010-12-08 18:20:28 +01:00
|
|
|
void
|
|
|
|
atomic_thread_fence(memory_order __m)
|
|
|
|
{
|
|
|
|
__atomic_thread_fence(__m);
|
2010-10-21 19:44:19 +02:00
|
|
|
}
|
|
|
|
|
2010-12-08 18:20:28 +01:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
void
|
|
|
|
atomic_signal_fence(memory_order __m)
|
|
|
|
{
|
|
|
|
__atomic_signal_fence(__m);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Atomics for standard typedef types
|
|
|
|
|
|
|
|
typedef atomic<char> atomic_char;
|
|
|
|
typedef atomic<signed char> atomic_schar;
|
|
|
|
typedef atomic<unsigned char> atomic_uchar;
|
|
|
|
typedef atomic<short> atomic_short;
|
|
|
|
typedef atomic<unsigned short> atomic_ushort;
|
|
|
|
typedef atomic<int> atomic_int;
|
|
|
|
typedef atomic<unsigned int> atomic_uint;
|
|
|
|
typedef atomic<long> atomic_long;
|
|
|
|
typedef atomic<unsigned long> atomic_ulong;
|
|
|
|
typedef atomic<long long> atomic_llong;
|
|
|
|
typedef atomic<unsigned long long> atomic_ullong;
|
|
|
|
typedef atomic<char16_t> atomic_char16_t;
|
|
|
|
typedef atomic<char32_t> atomic_char32_t;
|
|
|
|
typedef atomic<wchar_t> atomic_wchar_t;
|
|
|
|
|
|
|
|
typedef atomic<int_least8_t> atomic_int_least8_t;
|
|
|
|
typedef atomic<uint_least8_t> atomic_uint_least8_t;
|
|
|
|
typedef atomic<int_least16_t> atomic_int_least16_t;
|
|
|
|
typedef atomic<uint_least16_t> atomic_uint_least16_t;
|
|
|
|
typedef atomic<int_least32_t> atomic_int_least32_t;
|
|
|
|
typedef atomic<uint_least32_t> atomic_uint_least32_t;
|
|
|
|
typedef atomic<int_least64_t> atomic_int_least64_t;
|
|
|
|
typedef atomic<uint_least64_t> atomic_uint_least64_t;
|
|
|
|
|
|
|
|
typedef atomic<int_fast8_t> atomic_int_fast8_t;
|
|
|
|
typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
|
|
|
|
typedef atomic<int_fast16_t> atomic_int_fast16_t;
|
|
|
|
typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
|
|
|
|
typedef atomic<int_fast32_t> atomic_int_fast32_t;
|
|
|
|
typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
|
|
|
|
typedef atomic<int_fast64_t> atomic_int_fast64_t;
|
|
|
|
typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
|
|
|
|
|
|
|
|
typedef atomic<intptr_t> atomic_intptr_t;
|
|
|
|
typedef atomic<uintptr_t> atomic_uintptr_t;
|
|
|
|
typedef atomic<size_t> atomic_size_t;
|
|
|
|
typedef atomic<ptrdiff_t> atomic_ptrdiff_t;
|
|
|
|
typedef atomic<intmax_t> atomic_intmax_t;
|
|
|
|
typedef atomic<uintmax_t> atomic_uintmax_t;
|
|
|
|
|
|
|
|
#define ATOMIC_FLAG_INIT {false}
|
|
|
|
#define ATOMIC_VAR_INIT(__v) {__v}
|
|
|
|
|
|
|
|
// lock-free property
|
|
|
|
|
|
|
|
#define ATOMIC_CHAR_LOCK_FREE 0
|
|
|
|
#define ATOMIC_CHAR16_T_LOCK_FREE 0
|
|
|
|
#define ATOMIC_CHAR32_T_LOCK_FREE 0
|
|
|
|
#define ATOMIC_WCHAR_T_LOCK_FREE 0
|
|
|
|
#define ATOMIC_SHORT_LOCK_FREE 0
|
|
|
|
#define ATOMIC_INT_LOCK_FREE 0
|
|
|
|
#define ATOMIC_LONG_LOCK_FREE 0
|
|
|
|
#define ATOMIC_LLONG_LOCK_FREE 0
|
|
|
|
|
2011-03-31 18:39:39 +02:00
|
|
|
#endif // !__has_feature(cxx_atomic)
|
|
|
|
|
2010-09-27 23:17:38 +02:00
|
|
|
_LIBCPP_END_NAMESPACE_STD
|
|
|
|
|
|
|
|
#endif // _LIBCPP_ATOMIC
|