[vlc-devel] [PATCH 1/2] linux: fix vlc_futex_wait() cancellation

Thomas Guillem thomas at gllm.fr
Tue Feb 4 10:08:43 CET 2020


OK for me, 

On Mon, Feb 3, 2020, at 20:32, RĂ©mi Denis-Courmont wrote:
> As things stood, it works on Android (where the code is actually used)
> but not on desktop. There is a latent bug where cancellation is not
> acted up, leading to dead locks.
> ---
>  src/linux/thread.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/linux/thread.c b/src/linux/thread.c
> index 539c64f147..7e9dab63bd 100644
> --- a/src/linux/thread.c
> +++ b/src/linux/thread.c
> @@ -60,7 +60,12 @@ static int vlc_futex_wake(void *addr, int nr)
>  
>  static int vlc_futex_wait(void *addr, unsigned val, const struct timespec *to)
>  {
> -    return sys_futex(addr, FUTEX_WAIT_PRIVATE, val, to, NULL, 0);
> +    int ret, type;
> +
> +    pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &type);
> +    ret = sys_futex(addr, FUTEX_WAIT_PRIVATE, val, to, NULL, 0);
> +    pthread_setcanceltype(type, NULL);
> +    return ret;
>  }
>  
>  void vlc_addr_signal(void *addr)
> -- 
> 2.25.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list