xref: /llvm-project/libcxx/test/std/thread/thread.latch/count_down.pass.cpp (revision bf1666fb0bc19ffa18072e2727e4611c293a9aee)
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: no-threads
10 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 
12 // XFAIL: availability-synchronization_library-missing
13 
14 // <latch>
15 
16 #include <latch>
17 #include <thread>
18 
19 #include "make_test_thread.h"
20 #include "test_macros.h"
21 
22 int main(int, char**)
23 {
24   std::latch l(2);
25 
26   l.count_down();
27   std::thread t = support::make_test_thread([&](){
28     l.count_down();
29   });
30   l.wait();
31   t.join();
32 
33   return 0;
34 }
35