blob: 12be67c4f18ac1ee01b8d3697510404243657cac [file] [log] [blame]
Howard Hinnant748a5272010-09-30 21:05:29 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnant412dbeb2010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant748a5272010-09-30 21:05:29 +00007//
8//===----------------------------------------------------------------------===//
9
10// <atomic>
11
12// struct atomic_flag
13
14// void atomic_flag_clear(volatile atomic_flag*);
15// void atomic_flag_clear(atomic_flag*);
16
17#include <atomic>
18#include <cassert>
19
20int main()
21{
22 {
23 std::atomic_flag f;
24 f.test_and_set();
25 atomic_flag_clear(&f);
26 assert(f.test_and_set() == 0);
27 }
28 {
29 volatile std::atomic_flag f;
30 f.test_and_set();
31 atomic_flag_clear(&f);
32 assert(f.test_and_set() == 0);
33 }
34}