1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-threads
11 // notify_all_at_thread_exit(...) requires move semantics to transfer the unique_lock.
14 // <condition_variable>
16 // void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
18 #include <condition_variable>
24 #include "make_test_thread.h"
25 #include "test_macros.h"
27 std::condition_variable cv
;
30 typedef std::chrono::milliseconds ms
;
31 typedef std::chrono::high_resolution_clock Clock
;
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));
42 std::unique_lock
<std::mutex
> lk(mut
);
43 std::thread t
= support::make_test_thread(func
);
44 Clock::time_point t0
= Clock::now();
46 Clock::time_point t1
= Clock::now();
47 assert(t1
-t0
> ms(250));