Commit 21690901 authored by Ole André Vadla Ravnås's avatar Ole André Vadla Ravnås Committed by Olivier Crête

test-io-stream-common: Avoid CPU starvation by yielding

Busy-looping is not a good idea, especially not when run under Valgrind,
where such a thread may result in well-behaved threads running thousands
of times slower. While passing --fair-sched=yes to Valgrind avoids the
issue, it's still better to make our busy-looping less aggressive.
parent 751e8f58
......@@ -549,6 +549,8 @@ check_for_termination (TestIOStreamThreadData *data, gsize *recv_count,
while (*send_count < expected_recv_count) {
if (data->callbacks->wait_transmission_cb) {
data->callbacks->wait_transmission_cb (data->agent);
} else {
g_thread_yield ();
}
}
......
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