Ticket #6959: thread_sleep.patch
File thread_sleep.patch, 1.8 KB (added by , 10 years ago) |
---|
-
libs/thread/test/threads/this_thread/sleep_until/sleep_until_pass.cpp
16 16 // thread::id this_thread::get_id(); 17 17 18 18 #include <boost/thread/thread.hpp> 19 #include < cstdlib>19 #include <algorithm> 20 20 21 21 #include <boost/detail/lightweight_test.hpp> 22 22 … … 35 35 boost::chrono::nanoseconds err = ms / 100; 36 36 // The time slept is within 1% of 500ms 37 37 // This test is spurious as it depends on the time the thread system switches the threads 38 BOOST_TEST(std:: abs(static_cast<long>(ns.count())) < (err+boost::chrono::milliseconds(1000)).count());38 BOOST_TEST(std::max(ns, -ns) < (err+boost::chrono::milliseconds(1000))); 39 39 40 40 } 41 41 -
libs/thread/test/threads/this_thread/sleep_for/sleep_for_pass.cpp
16 16 // thread::id this_thread::get_id(); 17 17 18 18 #include <boost/thread/thread.hpp> 19 #include < cstdlib>19 #include <algorithm> 20 20 21 21 #include <boost/detail/lightweight_test.hpp> 22 22 … … 35 35 boost::chrono::nanoseconds err = ms / 100; 36 36 // The time slept is within 1% of 500ms 37 37 // This test is spurious as it depends on the time the thread system switches the threads 38 BOOST_TEST(std:: abs(static_cast<long>(ns.count())) < (err+boost::chrono::milliseconds(1000)).count());38 BOOST_TEST(std::max(ns, -ns) < (err/*+boost::chrono::milliseconds(1000)*/)); 39 39 return boost::report_errors(); 40 40 41 41 }