[cfe-commits] [libcxx] r121204 - /libcxx/trunk/include/atomic
Howard Hinnant
hhinnant at apple.com
Tue Dec 7 15:24:41 PST 2010
Author: hhinnant
Date: Tue Dec 7 17:24:41 2010
New Revision: 121204
URL: http://llvm.org/viewvc/llvm-project?rev=121204&view=rev
Log:
atomics ...
Modified:
libcxx/trunk/include/atomic
Modified: libcxx/trunk/include/atomic
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/atomic?rev=121204&r1=121203&r2=121204&view=diff
==============================================================================
--- libcxx/trunk/include/atomic (original)
+++ libcxx/trunk/include/atomic Tue Dec 7 17:24:41 2010
@@ -755,12 +755,6 @@
__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 @@
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,13 +864,20 @@
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
{return __atomic_fetch_add(&this->__a_, __op, __m);}
@@ -1459,6 +1467,48 @@
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
More information about the cfe-commits
mailing list