[libcxx-commits] [PATCH] D75950: [libc++abi] NFC: Move AtomicInt to cxa_guard_impl.h
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 12 15:45:39 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb0f1a4e7dffc: [libc++abi] NFC: Move AtomicInt to cxa_guard_impl.h (authored by ldionne).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75950/new/
https://reviews.llvm.org/D75950
Files:
libcxxabi/src/cxa_guard_impl.h
libcxxabi/src/include/atomic_support.h
Index: libcxxabi/src/include/atomic_support.h
===================================================================
--- libcxxabi/src/include/atomic_support.h
+++ libcxxabi/src/include/atomic_support.h
@@ -177,34 +177,4 @@
_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
Index: libcxxabi/src/cxa_guard_impl.h
===================================================================
--- libcxxabi/src/cxa_guard_impl.h
+++ libcxxabi/src/cxa_guard_impl.h
@@ -108,6 +108,32 @@
bool is_init = false;
};
+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;
+};
+
//===----------------------------------------------------------------------===//
// PlatformGetThreadID
//===----------------------------------------------------------------------===//
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75950.250078.patch
Type: text/x-patch
Size: 2357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200312/219f4667/attachment.bin>
More information about the libcxx-commits
mailing list