Merge branch 'onceinit-joins' into 'main'

tests: Add some missing g_thread_join() calls to onceinit test

See merge request GNOME/glib!3295
This commit is contained in:
Philip Withnall 2023-02-23 13:05:16 +00:00
commit 49467e3453

View File

@ -266,16 +266,22 @@ test_onceinit (void)
g_cond_broadcast (&tcond);
}
for (i = 0; i < N_THREADS; i++)
g_thread_join (threads[i]);
/* call multiple (unoptimized) initializers from multiple threads */
g_mutex_lock (&tmutex);
g_atomic_int_set (&thread_call_count, 0);
for (i = 0; i < N_THREADS; i++)
g_thread_new (NULL, stress_concurrent_initializers, NULL);
threads[i] = g_thread_new (NULL, stress_concurrent_initializers, NULL);
g_mutex_unlock (&tmutex);
while (g_atomic_int_get (&thread_call_count) < 256 * 4 * N_THREADS)
g_usleep (50 * 1000); /* wait for all 5 threads to complete */
for (i = 0; i < N_THREADS; i++)
g_thread_join (threads[i]);
}
int