]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/thread/test/sync/futures/future/wait_for_pass.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / thread / test / sync / futures / future / wait_for_pass.cpp
index 00f65fc0f17e1409f00e377e0a038ff89e93b5c7..71bca7abeead9bc5e36cfd05c31189ba959d04ad 100644 (file)
@@ -24,6 +24,7 @@
 //#define BOOST_THREAD_USES_LOG
 #define BOOST_THREAD_USES_LOG_THREAD_ID
 #include <boost/thread/detail/log.hpp>
+#include "../../../timming.hpp"
 
 #include <boost/thread/future.hpp>
 #include <boost/thread/thread.hpp>
@@ -37,6 +38,7 @@
 #endif
 
 typedef boost::chrono::milliseconds ms;
+typedef boost::chrono::nanoseconds ns;
 
 namespace boost
 {
@@ -85,11 +87,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()
 {
@@ -116,7 +114,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;
@@ -138,7 +137,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;
@@ -160,7 +160,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;