[vlc-devel] [PATCH 1/2] thread: winstore: Do not discard a signaled object.

Rémi Denis-Courmont remi at remlab.net
Thu Nov 20 14:54:19 CET 2014


Le 2014-11-20 16:36, Hugo Beauzée-Luyssen a écrit :
> When a thread is cancelled yet not killable, discarding a
> WAIT_OBJECT_X would cause the thread to wait forever, since
> vlc_testcancel would not abort the thread.

Does that problem not affect WAIT_TIMEOUT all the same?

A cancelled thread calling msleep(CLOCK_FREQ) will sleep only 50 
milliseconds AFAICT.

> ---
>  src/win32/thread.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/win32/thread.c b/src/win32/thread.c
> index fe17ad5..1cb2ee0 100644
> --- a/src/win32/thread.c
> +++ b/src/win32/thread.c
> @@ -81,7 +81,7 @@ static DWORD vlc_WaitForMultipleObjects (DWORD
> count, const HANDLE *handles,
>              ret = WaitForMultipleObjectsEx (count, handles, FALSE,
> new_delay, TRUE);
>              if (delay != INFINITE)
>                  delay -= new_delay;
> -            if (isCancelled())
> +            if (ret == WAIT_TIMEOUT && isCancelled())
>                  ret = WAIT_IO_COMPLETION;
>          } while (delay && ret == WAIT_TIMEOUT);
>  #else

-- 
Rémi Denis-Courmont



More information about the vlc-devel mailing list