]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/thread/test/sync/conditions/condition_variable/wait_until_pass.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / thread / test / sync / conditions / condition_variable / wait_until_pass.cpp
index 19fac0727a1e3c370e31a22dfe8860354fdca55f..34ef322684bfa5b90601bf1338617a7810c8f878 100644 (file)
 #include <boost/detail/lightweight_test.hpp>
 #include <iostream>
 #include <cassert>
+#include "../../../timming.hpp"
 
 #if defined BOOST_THREAD_USES_CHRONO
-
+typedef boost::chrono::milliseconds ms;
+typedef boost::chrono::nanoseconds ns;
 struct Clock
 {
   typedef boost::chrono::milliseconds duration;
@@ -44,16 +46,13 @@ struct Clock
 boost::condition_variable cv;
 boost::mutex mut;
 
+
 int test1 = 0;
 int test2 = 0;
 
 int runs = 0;
 
-#ifdef BOOST_THREAD_PLATFORM_WIN32
-const Clock::duration max_diff(250);
-#else
-const Clock::duration max_diff(75);
-#endif
+const ms max_diff(BOOST_THREAD_TEST_TIME_MS);
 
 void f()
 {
@@ -68,12 +67,14 @@ void f()
     Clock::time_point t1 = Clock::now();
     if (runs == 0)
     {
-      assert(t1 - t0 < max_diff);
+      ns d = t1 - t0;
+      BOOST_THREAD_TEST_IT(d, ns(max_diff));
       assert(test2 != 0);
     }
     else
     {
-      assert(t1 - t0 - Clock::duration(250) < max_diff);
+      ns d = t1 - t0 - Clock::duration(250);
+      BOOST_THREAD_TEST_IT(d, ns(max_diff));
       assert(test2 == 0);
     }
     ++runs;