Justin Bogner | fa75259 | 2015-05-08 05:39:05 +0000 | [diff] [blame] | 1 | /*===-- atomic_thread_fence.c -----------------------------------------------=== |
| 2 | * |
| 3 | * The LLVM Compiler Infrastructure |
| 4 | * |
| 5 | * This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | * Source Licenses. See LICENSE.TXT for details. |
| 7 | * |
| 8 | *===------------------------------------------------------------------------=== |
| 9 | * |
| 10 | * This file implements atomic_thread_fence from C11's stdatomic.h. |
| 11 | * |
| 12 | *===------------------------------------------------------------------------=== |
| 13 | */ |
| 14 | |
Chris Bieneman | 0a9466c | 2015-09-22 22:19:21 +0000 | [diff] [blame] | 15 | #ifndef __has_include |
| 16 | #define __has_include(inc) 0 |
| 17 | #endif |
| 18 | |
Chris Bieneman | 7908b12 | 2015-09-22 21:50:43 +0000 | [diff] [blame] | 19 | #if __has_include(<stdatomic.h>) |
| 20 | |
Justin Bogner | fa75259 | 2015-05-08 05:39:05 +0000 | [diff] [blame] | 21 | #include <stdatomic.h> |
| 22 | #undef atomic_thread_fence |
| 23 | void atomic_thread_fence(memory_order order) { |
| 24 | __c11_atomic_thread_fence(order); |
| 25 | } |
Chris Bieneman | 7908b12 | 2015-09-22 21:50:43 +0000 | [diff] [blame] | 26 | |
| 27 | #endif |