diff options
author | Ole André Vadla Ravnås <oleavr@gmail.com> | 2021-11-04 22:48:22 +0100 |
---|---|---|
committer | Olivier Crête <olivier.crete@ocrete.ca> | 2021-11-22 21:53:08 +0000 |
commit | 216909011efa8eef6089f311e5046032719c73cb (patch) | |
tree | d8692a4f985416283e4fdfecd82dac873f2dc4a6 | |
parent | 751e8f584cb5fd2d5b1643aed92822df23888bd7 (diff) | |
download | libnice-216909011efa8eef6089f311e5046032719c73cb.tar.gz |
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.
-rw-r--r-- | tests/test-io-stream-common.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/test-io-stream-common.c b/tests/test-io-stream-common.c index b3c12e6..dcd1304 100644 --- a/tests/test-io-stream-common.c +++ b/tests/test-io-stream-common.c @@ -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 (); } } |