OLD | NEW |
1 // -*- C++ -*- | 1 // -*- C++ -*- |
2 //===--------------------------- atomic -----------------------------------===// | 2 //===--------------------------- atomic -----------------------------------===// |
3 // | 3 // |
4 // The LLVM Compiler Infrastructure | 4 // The LLVM Compiler Infrastructure |
5 // | 5 // |
6 // This file is distributed under the University of Illinois Open Source | 6 // This file is distributed under the University of Illinois Open Source |
7 // License. See LICENSE.TXT for details. | 7 // License. See LICENSE.TXT for details. |
8 // | 8 // |
9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
10 | 10 |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 return __y; | 808 return __y; |
809 } | 809 } |
810 | 810 |
811 // general atomic<T> | 811 // general atomic<T> |
812 | 812 |
813 template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::valu
e> | 813 template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::valu
e> |
814 struct __atomic_base // false | 814 struct __atomic_base // false |
815 { | 815 { |
816 mutable _Atomic(_Tp) __a_; | 816 mutable _Atomic(_Tp) __a_; |
817 | 817 |
| 818 // @LOCALMOD-BEGIN The NaCl builtin delays resolution of the lock-free |
| 819 // property until translation time (time at which the |
| 820 // actual target is known). |
| 821 #if defined (__pnacl__) |
| 822 _LIBCPP_INLINE_VISIBILITY |
| 823 bool is_lock_free() const volatile _NOEXCEPT |
| 824 {return __nacl_atomic_is_lock_free(sizeof(_Tp), &__a_);} |
| 825 _LIBCPP_INLINE_VISIBILITY |
| 826 bool is_lock_free() const _NOEXCEPT |
| 827 {return __nacl_atomic_is_lock_free(sizeof(_Tp), &__a_);} |
| 828 #else |
818 _LIBCPP_INLINE_VISIBILITY | 829 _LIBCPP_INLINE_VISIBILITY |
819 bool is_lock_free() const volatile _NOEXCEPT | 830 bool is_lock_free() const volatile _NOEXCEPT |
820 {return __c11_atomic_is_lock_free(sizeof(_Tp));} | 831 {return __c11_atomic_is_lock_free(sizeof(_Tp));} |
821 _LIBCPP_INLINE_VISIBILITY | 832 _LIBCPP_INLINE_VISIBILITY |
822 bool is_lock_free() const _NOEXCEPT | 833 bool is_lock_free() const _NOEXCEPT |
823 {return __c11_atomic_is_lock_free(sizeof(_Tp));} | 834 {return __c11_atomic_is_lock_free(sizeof(_Tp));} |
| 835 #endif // @LOCALMOD-END |
824 _LIBCPP_INLINE_VISIBILITY | 836 _LIBCPP_INLINE_VISIBILITY |
825 void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXC
EPT | 837 void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXC
EPT |
826 {__c11_atomic_store(&__a_, __d, __m);} | 838 {__c11_atomic_store(&__a_, __d, __m);} |
827 _LIBCPP_INLINE_VISIBILITY | 839 _LIBCPP_INLINE_VISIBILITY |
828 void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT | 840 void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT |
829 {__c11_atomic_store(&__a_, __d, __m);} | 841 {__c11_atomic_store(&__a_, __d, __m);} |
830 _LIBCPP_INLINE_VISIBILITY | 842 _LIBCPP_INLINE_VISIBILITY |
831 _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT | 843 _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT |
832 {return __c11_atomic_load(&__a_, __m);} | 844 {return __c11_atomic_load(&__a_, __m);} |
833 _LIBCPP_INLINE_VISIBILITY | 845 _LIBCPP_INLINE_VISIBILITY |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1779 #define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE | 1791 #define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE |
1780 #define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE | 1792 #define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE |
1781 | 1793 |
1782 #endif // !__has_feature(cxx_atomic) | 1794 #endif // !__has_feature(cxx_atomic) |
1783 | 1795 |
1784 _LIBCPP_END_NAMESPACE_STD | 1796 _LIBCPP_END_NAMESPACE_STD |
1785 | 1797 |
1786 #endif // !_LIBCPP_HAS_NO_THREADS | 1798 #endif // !_LIBCPP_HAS_NO_THREADS |
1787 | 1799 |
1788 #endif // _LIBCPP_ATOMIC | 1800 #endif // _LIBCPP_ATOMIC |
OLD | NEW |