]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/thread/test/sync/futures/future/wait_until_pass.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / thread / test / sync / futures / future / wait_until_pass.cpp
index 1dcaea85143f8b63760060c82d29634709b3fea1..e9351671db5a88f9700f4f80e3586c88df8e5460 100644 (file)
@@ -30,6 +30,7 @@
 #include <boost/thread/thread.hpp>
 #include <boost/chrono/chrono_io.hpp>
 #include <boost/detail/lightweight_test.hpp>
+#include "../../../timming.hpp"
 
 #if defined BOOST_THREAD_USES_CHRONO
 
@@ -38,6 +39,7 @@
 #endif
 
 typedef boost::chrono::milliseconds ms;
+typedef boost::chrono::nanoseconds ns;
 
 namespace boost
 {
@@ -86,11 +88,7 @@ void func5(boost::promise<void> p)
   p.set_value();
 }
 
-#ifdef BOOST_THREAD_PLATFORM_WIN32
-const ms max_diff(250);
-#else
-const ms max_diff(75);
-#endif
+const ms max_diff(BOOST_THREAD_TEST_TIME_MS);
 
 int main()
 {
@@ -117,7 +115,8 @@ int main()
       f.wait();
       Clock::time_point t1 = Clock::now();
       BOOST_TEST(f.valid());
-      BOOST_TEST(t1 - t0 < max_diff);
+      ns d = t1 - t0;
+      BOOST_THREAD_TEST_IT(d, ns(max_diff));
     }
     {
       typedef int& T;
@@ -139,7 +138,8 @@ int main()
       f.wait();
       Clock::time_point t1 = Clock::now();
       BOOST_TEST(f.valid());
-      BOOST_TEST(t1 - t0 < max_diff);
+      ns d = t1 - t0;
+      BOOST_THREAD_TEST_IT(d, ns(max_diff));
     }
     {
       typedef void T;
@@ -161,7 +161,8 @@ int main()
       f.wait();
       Clock::time_point t1 = Clock::now();
       BOOST_TEST(f.valid());
-      BOOST_TEST(t1 - t0 < max_diff);
+      ns d = t1 - t0;
+      BOOST_THREAD_TEST_IT(d, ns(max_diff));
     }
   }
   BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;