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

Rémi Denis-Courmont remi at remlab.net
Wed Mar 8 18:19:34 CET 2017


Le keskiviikkona 8. maaliskuuta 2017, 10.57.16 EET Hugo Beauzée-Luyssen a 
écrit :
> ---
>  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;

We have plenty of users for alarm() and I certainly hope the plan is to not 
copy-paste the same over and over, regardless of the merits of the 
implementation.

Also depending on VLC timer before running the timer test does not sound like 
such a great idea.

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list