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
10 // UNSUPPORTED: c++03, c++11
12 // UNSUPPORTED: availability-shared_mutex-missing
18 // class shared_timed_mutex;
26 #include <shared_mutex>
29 #include "make_test_thread.h"
30 #include "test_macros.h"
32 std::shared_timed_mutex m
;
34 typedef std::chrono::system_clock Clock
;
35 typedef Clock::time_point time_point
;
36 typedef Clock::duration duration
;
37 typedef std::chrono::milliseconds ms
;
38 typedef std::chrono::nanoseconds ns
;
40 std::atomic
<bool> ready(false);
43 ms WaitTime
= ms(250);
49 time_point t0
= start
;
50 time_point t1
= Clock::now();
52 assert(t0
.time_since_epoch() > ms(0));
53 assert(t1
- t0
>= WaitTime
);
59 std::thread t
= support::make_test_thread(f
);
61 std::this_thread::yield();
63 std::this_thread::sleep_for(WaitTime
);