Home | History | Annotate | Download | only in atomics.flag
      1 //===----------------------------------------------------------------------===//
      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 // <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 
     20 int 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 }
     35