@@ -60,20 +60,22 @@ bool threadIsWaiting()
6060
6161#ifdef BOOST_THREAD_USES_DATETIME
6262
63- boost::posix_time::milliseconds posix_wait_time (1000 );
63+ boost::posix_time::milliseconds posix_wait_time (2000 );
6464
6565template <typename F>
6666void test_posix_wait_function (F f)
6767{
6868 flag = false ;
6969 waiting = false ;
7070 boost::thread t (f);
71+ boost::unique_lock<boost::mutex> lk (mut);
7172 while (!threadIsWaiting ())
7273 {
73- boost::this_thread::sleep (boost::posix_time::milliseconds (1 ));
74+ lk.unlock ();
75+ boost::this_thread::sleep (boost::posix_time::milliseconds (10 ));
76+ lk.lock ();
7477 }
7578
76- boost::unique_lock<boost::mutex> lk (mut);
7779 boost::this_thread::sleep (boost::posix_time::milliseconds (500 ));
7880 boost::posix_time::ptime t0 = boost::posix_time::microsec_clock::universal_time ();
7981 flag = true ;
@@ -82,7 +84,7 @@ void test_posix_wait_function(F f)
8284 t.join ();
8385 boost::posix_time::ptime t1 = boost::posix_time::microsec_clock::universal_time ();
8486
85- BOOST_TEST (t1 - t0 < boost::posix_time::milliseconds (250 ));
87+ BOOST_TEST (t1 - t0 < boost::posix_time::milliseconds (500 ));
8688}
8789
8890// ------------------------------------------------------------------------------
@@ -131,20 +133,22 @@ void timed_wait_relative_with_pred()
131133
132134#ifdef BOOST_THREAD_USES_CHRONO
133135
134- boost::chrono::milliseconds chrono_wait_time (1000 );
136+ boost::chrono::milliseconds chrono_wait_time (2000 );
135137
136138template <typename F>
137139void test_chrono_wait_function (F f)
138140{
139141 flag = false ;
140142 waiting = false ;
141143 boost::thread t (f);
144+ boost::unique_lock<boost::mutex> lk (mut);
142145 while (!threadIsWaiting ())
143146 {
144- boost::this_thread::sleep_for (boost::chrono::milliseconds (1 ));
147+ lk.unlock ();
148+ boost::this_thread::sleep_for (boost::chrono::milliseconds (10 ));
149+ lk.lock ();
145150 }
146151
147- boost::unique_lock<boost::mutex> lk (mut);
148152 boost::this_thread::sleep_for (boost::chrono::milliseconds (500 ));
149153 boost::chrono::steady_clock::time_point t0 = boost::chrono::steady_clock::now ();
150154 flag = true ;
@@ -153,7 +157,7 @@ void test_chrono_wait_function(F f)
153157 t.join ();
154158 boost::chrono::steady_clock::time_point t1 = boost::chrono::steady_clock::now ();
155159
156- BOOST_TEST (t1 - t0 < boost::chrono::milliseconds (250 ));
160+ BOOST_TEST (t1 - t0 < boost::chrono::milliseconds (500 ));
157161}
158162
159163// ------------------------------------------------------------------------------
0 commit comments