[vlc-devel] [PATCH] win32/thread: avoid waking up every 50ms to see if the thread is canceled
Rémi Denis-Courmont
remi at remlab.net
Mon Jul 20 15:33:24 CEST 2015
Le 2015-07-20 16:23, Steve Lhomme a écrit :
> From: Steve Lhomme <robUx4 at gmail.com>
>
> set the killEvent when we cancel the thread, which will wake up
> vlc_WaitForMultipleObjects()
> ---
> src/win32/thread.c | 41 ++++++++++++++++++++++++++---------------
> 1 file changed, 26 insertions(+), 15 deletions(-)
>
> diff --git a/src/win32/thread.c b/src/win32/thread.c
> index 39711b4..ed9fc72 100644
> --- a/src/win32/thread.c
> +++ b/src/win32/thread.c
> @@ -49,10 +49,10 @@ static vlc_cond_t super_variable;
> static bool isCancelled(void);
> #endif
>
> -static DWORD vlc_WaitForMultipleObjects (DWORD count, const HANDLE
> *handles,
> +static DWORD vlc_WaitForMultipleObjects (DWORD count, HANDLE handle,
> DWORD delay)
> {
> - DWORD ret;
> + DWORD ret = WAIT_FAILED;
> if (count == 0)
> {
> #if VLC_WINSTORE_APP
> @@ -73,20 +73,16 @@ static DWORD vlc_WaitForMultipleObjects (DWORD
> count, const HANDLE *handles,
> if (ret == 0)
> ret = WAIT_TIMEOUT;
> }
> - else {
> + else if (count == 1 && handle != NULL)
What if count is not one?
What is "handle != NULL" for?
What if poll() is used?
More importantly, this fix is likely in vain given that
vlc_cond_broadcast() is broken on Windows (not only WinRT).
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list