blob: da912af643127477a91d537e9deb9e19bd242462 [file] [log] [blame]
Justin Bognerfa752592015-05-08 05:39:05 +00001/*===-- atomic_flag_clear.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_flag_clear from C11's stdatomic.h.
11 *
12 *===------------------------------------------------------------------------===
13 */
14
Chris Bieneman0a9466c2015-09-22 22:19:21 +000015#ifndef __has_include
16#define __has_include(inc) 0
17#endif
18
Chris Bieneman7908b122015-09-22 21:50:43 +000019#if __has_include(<stdatomic.h>)
20
Justin Bognerfa752592015-05-08 05:39:05 +000021#include <stdatomic.h>
22#undef atomic_flag_clear
23void atomic_flag_clear(volatile atomic_flag *object) {
Chris Bienemanbe617202015-09-22 23:35:24 +000024 __c11_atomic_store(&(object)->_Value, 0, __ATOMIC_SEQ_CST);
Justin Bognerfa752592015-05-08 05:39:05 +000025}
Chris Bieneman7908b122015-09-22 21:50:43 +000026
27#endif