diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2021-01-02 20:29:54 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2021-01-02 20:29:54 +0000 |
commit | ac7a26ed5f28508703c1e3845c41e31d0aadd08e (patch) | |
tree | a17a30ef81db524d1aad6906df9b645b35fb1294 /gnu/llvm/libcxxabi | |
parent | 2bd57dd5735c7bb72b79ab71f310295139a20ed4 (diff) |
Import libc++abi 10.0.1 release.
Diffstat (limited to 'gnu/llvm/libcxxabi')
-rw-r--r-- | gnu/llvm/libcxxabi/src/include/atomic_support.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gnu/llvm/libcxxabi/src/include/atomic_support.h b/gnu/llvm/libcxxabi/src/include/atomic_support.h index 6f9dbf43604..4ff45eb93ad 100644 --- a/gnu/llvm/libcxxabi/src/include/atomic_support.h +++ b/gnu/llvm/libcxxabi/src/include/atomic_support.h @@ -177,4 +177,34 @@ bool __libcpp_atomic_compare_exchange(_ValueType* __val, _LIBCPP_END_NAMESPACE_STD +namespace { + +template <class IntType> +class AtomicInt { +public: + using MemoryOrder = std::__libcpp_atomic_order; + + explicit AtomicInt(IntType *b) : b(b) {} + AtomicInt(AtomicInt const&) = delete; + AtomicInt& operator=(AtomicInt const&) = delete; + + IntType load(MemoryOrder ord) { + return std::__libcpp_atomic_load(b, ord); + } + void store(IntType val, MemoryOrder ord) { + std::__libcpp_atomic_store(b, val, ord); + } + IntType exchange(IntType new_val, MemoryOrder ord) { + return std::__libcpp_atomic_exchange(b, new_val, ord); + } + bool compare_exchange(IntType *expected, IntType desired, MemoryOrder ord_success, MemoryOrder ord_failure) { + return std::__libcpp_atomic_compare_exchange(b, expected, desired, ord_success, ord_failure); + } + +private: + IntType *b; +}; + +} // end namespace + #endif // ATOMIC_SUPPORT_H |