summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Chisnall <dchisnall@pathscale.com>2011-11-24 17:05:59 +0000
committerDavid Chisnall <dchisnall@pathscale.com>2011-11-24 17:05:59 +0000
commitc7d66e279e31c0523bcb8bc5b1dd5c98260f0848 (patch)
treea9fa2efe413c0a3b16070491648d782a65db7e4a /src
parent04a6546f5a628aaa29670a204e68c4d3120bb741 (diff)
downloadlibcxxrt-c7d66e279e31c0523bcb8bc5b1dd5c98260f0848.tar.gz
libcxxrt-c7d66e279e31c0523bcb8bc5b1dd5c98260f0848.tar.bz2
libcxxrt-c7d66e279e31c0523bcb8bc5b1dd5c98260f0848.tar.xz
Use __sync_swap when available.
Diffstat (limited to 'src')
-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);
}
}