1*0ba22f51SPetr Hosek //===-- atomic_flag_clear.c -----------------------------------------------===// 2*0ba22f51SPetr Hosek // 3*0ba22f51SPetr Hosek // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0ba22f51SPetr Hosek // See https://llvm.org/LICENSE.txt for license information. 5*0ba22f51SPetr Hosek // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0ba22f51SPetr Hosek // 7*0ba22f51SPetr Hosek //===----------------------------------------------------------------------===// 8*0ba22f51SPetr Hosek // 9*0ba22f51SPetr Hosek // This file implements atomic_flag_clear from C11's stdatomic.h. 10*0ba22f51SPetr Hosek // 11*0ba22f51SPetr Hosek //===----------------------------------------------------------------------===// 12fa752593SJustin Bogner 130a9466c1SChris Bieneman #ifndef __has_include 140a9466c1SChris Bieneman #define __has_include(inc) 0 150a9466c1SChris Bieneman #endif 160a9466c1SChris Bieneman 177908b129SChris Bieneman #if __has_include(<stdatomic.h>) 187908b129SChris Bieneman 19fa752593SJustin Bogner #include <stdatomic.h> 20fa752593SJustin Bogner #undef atomic_flag_clear atomic_flag_clear(volatile atomic_flag * object)21fa752593SJustin Bognervoid atomic_flag_clear(volatile atomic_flag *object) { 22be61720cSChris Bieneman __c11_atomic_store(&(object)->_Value, 0, __ATOMIC_SEQ_CST); 23fa752593SJustin Bogner } 247908b129SChris Bieneman 257908b129SChris Bieneman #endif 26