summaryrefslogtreecommitdiff
path: root/lib/builtins/atomic_thread_fence.c
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-05-08 05:39:05 +0000
committerJustin Bogner <mail@justinbogner.com>2015-05-08 05:39:05 +0000
commit0c904ece562d5c6f9df57e42b56dd5533db7d2bb (patch)
tree4bb926b34dba3234113d0dea992824309fcd7ea9 /lib/builtins/atomic_thread_fence.c
parent49afa2c4e79b8840de86ce633b12e3380c7c2801 (diff)
builtins: Implement the functions from stdatomic.h
Talking to John and Doug, we concluded that these functions from stdatomic really do belong here in compiler-rt rather than in libc, since the compiler owns stdatomic.h and these need to refer to clang-specific builtins. Nonetheless, I've only added these on darwin for now - other platforms should probably do the same unless their libc does implement these functions. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/builtins/atomic_thread_fence.c')
-rw-r--r--lib/builtins/atomic_thread_fence.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/builtins/atomic_thread_fence.c b/lib/builtins/atomic_thread_fence.c
new file mode 100644
index 000000000..71f698c9d
--- /dev/null
+++ b/lib/builtins/atomic_thread_fence.c
@@ -0,0 +1,19 @@
+/*===-- atomic_thread_fence.c -----------------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ *===------------------------------------------------------------------------===
+ *
+ * This file implements atomic_thread_fence from C11's stdatomic.h.
+ *
+ *===------------------------------------------------------------------------===
+ */
+
+#include <stdatomic.h>
+#undef atomic_thread_fence
+void atomic_thread_fence(memory_order order) {
+ __c11_atomic_thread_fence(order);
+}