mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-28 16:36:14 +01:00
tests: Add some missing g_thread_join() calls to onceinit test
Running the test under asan was failing as the threads were being leaked. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
88fd3f0a76
commit
ac5589128c
@ -266,16 +266,22 @@ test_onceinit (void)
|
|||||||
g_cond_broadcast (&tcond);
|
g_cond_broadcast (&tcond);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < N_THREADS; i++)
|
||||||
|
g_thread_join (threads[i]);
|
||||||
|
|
||||||
/* call multiple (unoptimized) initializers from multiple threads */
|
/* call multiple (unoptimized) initializers from multiple threads */
|
||||||
g_mutex_lock (&tmutex);
|
g_mutex_lock (&tmutex);
|
||||||
g_atomic_int_set (&thread_call_count, 0);
|
g_atomic_int_set (&thread_call_count, 0);
|
||||||
|
|
||||||
for (i = 0; i < N_THREADS; i++)
|
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);
|
g_mutex_unlock (&tmutex);
|
||||||
|
|
||||||
while (g_atomic_int_get (&thread_call_count) < 256 * 4 * N_THREADS)
|
while (g_atomic_int_get (&thread_call_count) < 256 * 4 * N_THREADS)
|
||||||
g_usleep (50 * 1000); /* wait for all 5 threads to complete */
|
g_usleep (50 * 1000); /* wait for all 5 threads to complete */
|
||||||
|
|
||||||
|
for (i = 0; i < N_THREADS; i++)
|
||||||
|
g_thread_join (threads[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user