[vlc-devel] [PATCH 1/2] tests: interrupt: Fix win32 build

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Mar 8 10:57:16 CET 2017


---
 src/test/interrupt.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/test/interrupt.c b/src/test/interrupt.c
index d58b52160c..463ee9dfb6 100644
--- a/src/test/interrupt.c
+++ b/src/test/interrupt.c
@@ -104,17 +104,32 @@ static void *test_thread_cancel(void *data)
     /* Test context clearing on cancellation */
     vlc_interrupt_set(ctx);
     for (;;)
+    {
+#ifndef _WIN32
         pause();
+#else
+        SleepEx(INFINITE, true);
+        vlc_testcancel();
+#endif
+    }
 
     vlc_assert_unreachable();
 }
 
+static void cancel_tests(void* data)
+{
+    (void)data;
+    assert(!"test timedout");
+}
+
 int main (void)
 {
     vlc_interrupt_t *ctx;
     vlc_thread_t th;
+    vlc_timer_t timer;
 
-    alarm(2);
+    assert(vlc_timer_create(&timer, cancel_tests, NULL) == 0);
+    vlc_timer_schedule(timer, false, 2 * CLOCK_FREQ, 0);
 
     ctx = vlc_interrupt_create();
     assert(ctx != NULL);
@@ -139,6 +154,7 @@ int main (void)
     vlc_cancel(th);
     vlc_join(th, NULL);
 
+    vlc_timer_destroy(timer);
     vlc_interrupt_destroy(ctx);
     vlc_sem_destroy(&sem);
     return 0;
-- 
2.11.0



More information about the vlc-devel mailing list