1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // UNSUPPORTED: libcpp-has-no-threads 10 11 // <atomic> 12 13 // struct atomic_flag 14 15 // void atomic_flag_clear(volatile atomic_flag*); 16 // void atomic_flag_clear(atomic_flag*); 17 18 #include <atomic> 19 #include <cassert> 20 21 #include "test_macros.h" 22 main(int,char **)23int main(int, char**) 24 { 25 { 26 std::atomic_flag f; 27 f.clear(); 28 f.test_and_set(); 29 atomic_flag_clear(&f); 30 assert(f.test_and_set() == 0); 31 } 32 { 33 volatile std::atomic_flag f; 34 f.clear(); 35 f.test_and_set(); 36 atomic_flag_clear(&f); 37 assert(f.test_and_set() == 0); 38 } 39 40 return 0; 41 } 42