[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / thread / thread.condition / notify_all_at_thread_exit.pass.cpp
blob1f23c13ddeb8987ff3ff31138da5469f95afcf15
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
11 // notify_all_at_thread_exit(...) requires move semantics to transfer the unique_lock.
12 // UNSUPPORTED: c++03
14 // <condition_variable>
16 // void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
18 #include <condition_variable>
19 #include <mutex>
20 #include <thread>
21 #include <chrono>
22 #include <cassert>
24 #include "make_test_thread.h"
25 #include "test_macros.h"
27 std::condition_variable cv;
28 std::mutex mut;
30 typedef std::chrono::milliseconds ms;
31 typedef std::chrono::high_resolution_clock Clock;
33 void func()
35 std::unique_lock<std::mutex> lk(mut);
36 std::notify_all_at_thread_exit(cv, std::move(lk));
37 std::this_thread::sleep_for(ms(300));
40 int main(int, char**)
42 std::unique_lock<std::mutex> lk(mut);
43 std::thread t = support::make_test_thread(func);
44 Clock::time_point t0 = Clock::now();
45 cv.wait(lk);
46 Clock::time_point t1 = Clock::now();
47 assert(t1-t0 > ms(250));
48 t.join();
50 return 0;