tests: systemclock: Stop all stress threads before joining them

This reduces the chance of the main thread getting starved while trying
to shut down the test, potentially causing a timeout.

Even on an idle 96-processor system this reduces the duration of the
systemclock tests from ~8s to ~3s.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/734>
This commit is contained in:
Jan Alexander Steffens (heftig) 2021-01-14 15:50:05 +01:00
parent b95941db55
commit 3a380558bd

View file

@ -328,6 +328,9 @@ GST_START_TEST (test_stress_cleanup_unschedule)
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
WaitUnscheduleData *d = &data[i]; WaitUnscheduleData *d = &data[i];
d->running = FALSE; d->running = FALSE;
}
for (i = 0; i < num; i++) {
WaitUnscheduleData *d = &data[i];
g_thread_join (d->thread_wait); g_thread_join (d->thread_wait);
g_thread_join (d->thread_unschedule); g_thread_join (d->thread_unschedule);
g_mutex_clear (&d->lock); g_mutex_clear (&d->lock);
@ -370,6 +373,9 @@ GST_START_TEST (test_stress_reschedule)
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
WaitUnscheduleData *d = &data[i]; WaitUnscheduleData *d = &data[i];
d->running = FALSE; d->running = FALSE;
}
for (i = 0; i < num; i++) {
WaitUnscheduleData *d = &data[i];
g_thread_join (d->thread_wait); g_thread_join (d->thread_wait);
g_thread_join (d->thread_unschedule); g_thread_join (d->thread_unschedule);
g_mutex_clear (&d->lock); g_mutex_clear (&d->lock);