tests: systemclock: Stop all stress threads before joining them
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Thu, 14 Jan 2021 14:50:05 +0000 (15:50 +0100)
committerJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Thu, 14 Jan 2021 14:50:05 +0000 (15:50 +0100)
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>

tests/check/gst/gstsystemclock.c

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