Problem: Spinning on atomics can cause hangs

Solution: Add a sleep in the loop. Some versions of
valgrind may hang when spinning on atomic variables.
parent 4c1d720a
...@@ -103,6 +103,7 @@ void wait_in_events (test_events_t &events_) ...@@ -103,6 +103,7 @@ void wait_in_events (test_events_t &events_)
{ {
void *watch = zmq_stopwatch_start (); void *watch = zmq_stopwatch_start ();
while (events_.in_events.get () < 1) { while (events_.in_events.get () < 1) {
msleep (1);
#ifdef ZMQ_BUILD_DRAFT #ifdef ZMQ_BUILD_DRAFT
TEST_ASSERT_LESS_OR_EQUAL_MESSAGE (SETTLE_TIME, TEST_ASSERT_LESS_OR_EQUAL_MESSAGE (SETTLE_TIME,
zmq_stopwatch_intermediate (watch), zmq_stopwatch_intermediate (watch),
...@@ -116,6 +117,7 @@ void wait_timer_events (test_events_t &events_) ...@@ -116,6 +117,7 @@ void wait_timer_events (test_events_t &events_)
{ {
void *watch = zmq_stopwatch_start (); void *watch = zmq_stopwatch_start ();
while (events_.timer_events.get () < 1) { while (events_.timer_events.get () < 1) {
msleep (1);
#ifdef ZMQ_BUILD_DRAFT #ifdef ZMQ_BUILD_DRAFT
TEST_ASSERT_LESS_OR_EQUAL_MESSAGE (SETTLE_TIME, TEST_ASSERT_LESS_OR_EQUAL_MESSAGE (SETTLE_TIME,
zmq_stopwatch_intermediate (watch), zmq_stopwatch_intermediate (watch),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment