atomics ...

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121204 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2010-12-07 23:24:41 +00:00
parent 57e5e87323
commit d2f6afbfab

View File

@ -755,12 +755,6 @@ struct __atomic_base // false
__atomic_base(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) volatile = delete;
_LIBCPP_INLINE_VISIBILITY
_Tp operator=(_Tp __d) volatile
{store(__d); return __d;}
_LIBCPP_INLINE_VISIBILITY
_Tp operator=(_Tp __d)
{store(__d); return __d;}
};
// atomic<Integral>
@ -855,6 +849,13 @@ struct atomic
atomic() {} // = default;
_LIBCPP_INLINE_VISIBILITY
/*constexpr*/ atomic(_Tp __d) : __base(__d) {}
_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;}
};
// atomic<T*>
@ -863,12 +864,19 @@ template <class _Tp>
struct atomic<_Tp*>
: public __atomic_base<_Tp*>
{
typedef __atomic_base<_Tp> __base;
typedef __atomic_base<_Tp*> __base;
_LIBCPP_INLINE_VISIBILITY
atomic() {} // = default;
_LIBCPP_INLINE_VISIBILITY
/*constexpr*/ atomic(_Tp* __d) : __base(__d) {}
_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;}
_LIBCPP_INLINE_VISIBILITY
_Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
volatile
@ -1459,6 +1467,48 @@ atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m)
return __o->fetch_xor(__op, __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;
/*
// flag type and operations