summaryrefslogtreecommitdiff
path: root/src/memory.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/memory.cc')
-rw-r--r--src/memory.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/memory.cc b/src/memory.cc
index a5eb3e9..027bc3f 100644
--- a/src/memory.cc
+++ b/src/memory.cc
@@ -11,6 +11,10 @@
#include <stdlib.h>
#include "stdexcept.h"
+#if !__has_builtin(__sync_swap)
+#define __sync_swap __sync_lock_test_and_set
+#endif
+
namespace std
{
struct nothrow_t {};
@@ -33,7 +37,7 @@ namespace std
__attribute__((weak))
new_handler set_new_handler(new_handler handler)
{
- return __sync_lock_test_and_set(&new_handl, handler);
+ return __sync_swap(&new_handl, handler);
}
}