Commit 441f0b22 authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête

tests: Remove a potential race from test-thread

A g_usleep() was introduced in commit
e22ecb19 to fix a potential race where
the non-main threads would finish all their work before the error_loop
was started, leaving the error_loop to run for 30s then abort the test.

A better fix, instead of doing a racy sleep, is to have the non-main
threads spin until the error_loop is running. GLib takes care of all the
locking for us, and since we don’t care about efficiency for test cases,
spinning is fine (the wait is also going to be quite short).
parent d0c5adbf
......@@ -69,7 +69,9 @@ mainloop_thread (gpointer data)
GMainLoop *loop = data;
g_usleep (100000);
/* Synchronise thread starting. */
while (!g_main_loop_is_running (error_loop));
g_main_loop_run (loop);
return NULL;
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