]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/thread/test/sync/mutual_exclusion/null_mutex/try_lock_for_pass.cpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / libs / thread / test / sync / mutual_exclusion / null_mutex / try_lock_for_pass.cpp
index 6aaac4faa6af21d042436af26e533bee57ca3a35..a70c98410ebc42fe7dce0e928f8aab27fb364c40 100644 (file)
@@ -34,18 +34,22 @@ typedef Clock::duration duration;
 typedef boost::chrono::milliseconds ms;
 typedef boost::chrono::nanoseconds ns;
 
+#ifdef BOOST_THREAD_PLATFORM_WIN32
+const ms max_diff(250);
+#else
+const ms max_diff(50);
+#endif
+
 void f1()
 {
   time_point t0 = Clock::now();
-  // This test is spurious as it depends on the time the thread system switches the threads
-  BOOST_TEST(m.try_lock_for(ms(100)) == true);
+  BOOST_TEST(m.try_lock_for(ms(250)) == true);
   time_point t1 = Clock::now();
   BOOST_TEST(m.try_lock());
   m.unlock();
   m.unlock();
   ns d = t1 - t0 ;
-  // This test is spurious as it depends on the time the thread system switches the threads
-  BOOST_TEST(d < ns(5000000)); // within 5ms
+  BOOST_TEST(d < max_diff);
 }