summaryrefslogtreecommitdiffstats
path: root/lib/libcxxabi/src/include/refstring.h
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-02-04 16:55:17 +0000
committerpatrick <patrick@openbsd.org>2019-02-04 16:55:17 +0000
commit79b3959bf0bd0a9885328f3a8b81bd84271245d9 (patch)
tree0b07affff0e2a349a07a444d20083dd65fbf27f4 /lib/libcxxabi/src/include/refstring.h
parentImport libunwind 7.0.1 (diff)
downloadwireguard-openbsd-79b3959bf0bd0a9885328f3a8b81bd84271245d9.tar.xz
wireguard-openbsd-79b3959bf0bd0a9885328f3a8b81bd84271245d9.zip
Import libc++abi 7.0.1.
Diffstat (limited to 'lib/libcxxabi/src/include/refstring.h')
-rw-r--r--lib/libcxxabi/src/include/refstring.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libcxxabi/src/include/refstring.h b/lib/libcxxabi/src/include/refstring.h
index bc131aeb5ae..69f6747e125 100644
--- a/lib/libcxxabi/src/include/refstring.h
+++ b/lib/libcxxabi/src/include/refstring.h
@@ -22,6 +22,7 @@
#include <dlfcn.h>
#include <mach-o/dyld.h>
#endif
+#include "atomic_support.h"
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -87,7 +88,7 @@ __libcpp_refstring::__libcpp_refstring(const __libcpp_refstring &s) _NOEXCEPT
: __imp_(s.__imp_)
{
if (__uses_refcount())
- __sync_add_and_fetch(&rep_from_data(__imp_)->count, 1);
+ __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1);
}
inline
@@ -96,10 +97,10 @@ __libcpp_refstring& __libcpp_refstring::operator=(__libcpp_refstring const& s) _
struct _Rep_base *old_rep = rep_from_data(__imp_);
__imp_ = s.__imp_;
if (__uses_refcount())
- __sync_add_and_fetch(&rep_from_data(__imp_)->count, 1);
+ __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1);
if (adjust_old_count)
{
- if (__sync_add_and_fetch(&old_rep->count, count_t(-1)) < 0)
+ if (__libcpp_atomic_add(&old_rep->count, count_t(-1)) < 0)
{
::operator delete(old_rep);
}
@@ -111,7 +112,7 @@ inline
__libcpp_refstring::~__libcpp_refstring() {
if (__uses_refcount()) {
_Rep_base* rep = rep_from_data(__imp_);
- if (__sync_add_and_fetch(&rep->count, count_t(-1)) < 0) {
+ if (__libcpp_atomic_add(&rep->count, count_t(-1)) < 0) {
::operator delete(rep);
}
}