[glib: 2/3] tests: Shorten another sleep/retry loop in thread-pool-slow




commit c530debb6251a31f83b2c9d92fd11edee0deffa6
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu Jun 30 14:14:47 2022 +0100

    tests: Shorten another sleep/retry loop in thread-pool-slow
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/tests/thread-pool-slow.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/glib/tests/thread-pool-slow.c b/glib/tests/thread-pool-slow.c
index cef02db778..a5445411d6 100644
--- a/glib/tests/thread-pool-slow.c
+++ b/glib/tests/thread-pool-slow.c
@@ -94,14 +94,9 @@ test_thread_stop_unused (void)
 
    g_thread_pool_stop_unused_threads ();
 
-   for (i = 0; i < 5; i++)
-     {
-       if (g_thread_pool_get_num_unused_threads () == 0)
-         break;
-
-       /* Some time for threads to die. */
-       g_usleep (G_USEC_PER_SEC);
-     }
+   /* Wait for threads to die. */
+   while (g_thread_pool_get_num_unused_threads () != 0)
+     g_usleep (100);
 
    g_assert_cmpint (g_thread_pool_get_num_unused_threads (), ==, 0);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]