summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2011-07-20 10:49:48 +0200
committerRyan Lortie <desrt@desrt.ca>2011-07-20 10:51:16 +0200
commitdbd0d63b6b45036c2b485b8e1993edf97970afd2 (patch)
tree9489ed48130018afe877881fdeb9218c3bf9c0ef /tests
parent265f245376a3af5a006854ee96a484cf30fbc170 (diff)
wait longer in threadpool test case
If we are going to fail an assert, wait for a bit longer before doing so (up to 5 seconds, if needed). This is a long-standing Debian patch to fix build failures on really slow machines.
Diffstat (limited to 'tests')
-rw-r--r--tests/threadpool-test.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/threadpool-test.c b/tests/threadpool-test.c
index db15b368a..4d011ff3f 100644
--- a/tests/threadpool-test.c
+++ b/tests/threadpool-test.c
@@ -124,10 +124,17 @@ test_thread_stop_unused (void)
DEBUG_MSG (("[unused] stopping unused threads"));
g_thread_pool_stop_unused_threads ();
- DEBUG_MSG (("[unused] waiting ONE second for threads to die"));
+ for (i = 0; i < 5; i++)
+ {
+ if (g_thread_pool_get_num_unused_threads () == 0 &&
+ test_count_threads () == 0)
+ break;
- /* Some time for threads to die. */
- g_usleep (G_USEC_PER_SEC);
+ DEBUG_MSG (("[unused] waiting ONE second for threads to die"));
+
+ /* Some time for threads to die. */
+ g_usleep (G_USEC_PER_SEC);
+ }
DEBUG_MSG (("[unused] stopped idle threads, %d remain, %d threads still exist",
g_thread_pool_get_num_unused_threads (),