File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,24 @@ BOOST_AUTO_TEST_CASE(manythreads)
98
98
BOOST_CHECK_EQUAL (counterSum, 200 );
99
99
}
100
100
101
+ BOOST_AUTO_TEST_CASE (wait_until_past)
102
+ {
103
+ std::condition_variable condvar;
104
+ Mutex mtx;
105
+ WAIT_LOCK (mtx, lock);
106
+
107
+ const auto no_wait= [&](const std::chrono::seconds& d) {
108
+ return condvar.wait_until (lock, std::chrono::system_clock::now () - d);
109
+ };
110
+
111
+ BOOST_CHECK (std::cv_status::timeout == no_wait (std::chrono::seconds{1 }));
112
+ BOOST_CHECK (std::cv_status::timeout == no_wait (std::chrono::minutes{1 }));
113
+ BOOST_CHECK (std::cv_status::timeout == no_wait (std::chrono::hours{1 }));
114
+ BOOST_CHECK (std::cv_status::timeout == no_wait (std::chrono::hours{10 }));
115
+ BOOST_CHECK (std::cv_status::timeout == no_wait (std::chrono::hours{100 }));
116
+ BOOST_CHECK (std::cv_status::timeout == no_wait (std::chrono::hours{1000 }));
117
+ }
118
+
101
119
BOOST_AUTO_TEST_CASE (singlethreadedscheduler_ordered)
102
120
{
103
121
CScheduler scheduler;
You can’t perform that action at this time.
0 commit comments