mirror of
https://github.com/boostorg/atomic.git
synced 2026-01-19 04:02:09 +00:00
Use absolute timeouts for sleeping in wait test helpers.
This may improve the precision of timing of thread wakeups.
This commit is contained in:
@@ -92,12 +92,12 @@ public:
|
||||
|
||||
test_clock::time_point start_time = test_clock::now();
|
||||
|
||||
std::this_thread::sleep_for(chrono::milliseconds(200));
|
||||
std::this_thread::sleep_until(start_time + chrono::milliseconds(200));
|
||||
|
||||
m_wrapper.a.store(m_value2, boost::memory_order_release);
|
||||
m_wrapper.a.notify_one();
|
||||
|
||||
std::this_thread::sleep_for(chrono::milliseconds(200));
|
||||
std::this_thread::sleep_until(start_time + chrono::milliseconds(400));
|
||||
|
||||
m_wrapper.a.store(m_value3, boost::memory_order_release);
|
||||
m_wrapper.a.notify_one();
|
||||
@@ -226,7 +226,7 @@ public:
|
||||
|
||||
test_clock::time_point start_time = test_clock::now();
|
||||
|
||||
std::this_thread::sleep_for(chrono::milliseconds(200));
|
||||
std::this_thread::sleep_until(start_time + chrono::milliseconds(200));
|
||||
|
||||
m_wrapper.a.store(m_value2, boost::memory_order_release);
|
||||
m_wrapper.a.notify_all();
|
||||
|
||||
@@ -89,12 +89,12 @@ public:
|
||||
|
||||
test_clock::time_point start_time = test_clock::now();
|
||||
|
||||
std::this_thread::sleep_for(chrono::milliseconds(200));
|
||||
std::this_thread::sleep_until(start_time + chrono::milliseconds(200));
|
||||
|
||||
m_wrapper.a.store(m_value2, boost::memory_order_release);
|
||||
m_wrapper.a.notify_one();
|
||||
|
||||
std::this_thread::sleep_for(chrono::milliseconds(200));
|
||||
std::this_thread::sleep_until(start_time + chrono::milliseconds(400));
|
||||
|
||||
m_wrapper.a.store(m_value3, boost::memory_order_release);
|
||||
m_wrapper.a.notify_one();
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
|
||||
test_clock::time_point start_time = test_clock::now();
|
||||
|
||||
std::this_thread::sleep_for(chrono::milliseconds(200));
|
||||
std::this_thread::sleep_until(start_time + chrono::milliseconds(200));
|
||||
|
||||
m_wrapper.a.store(m_value2, boost::memory_order_release);
|
||||
m_wrapper.a.notify_all();
|
||||
|
||||
Reference in New Issue
Block a user