[vlc-devel] [RFCv2] Thread cancellation on WinCE

Rémi Denis-Courmont rem at videolan.org
Thu Nov 20 16:14:45 CET 2008


On Thursday 20 November 2008 11:23:21 Pierre Ynard, you wrote:
> +#  define VLC_CANCEL_INIT { NULL, true, false, NULL }

NULL is the error case for HANDLE?

> +static DWORD vlc_cancelable_wait (DWORD count, const HANDLE *handles,
> +                                  DWORD delay)
> +{
> +    vlc_cancel_t *nfo = vlc_threadvar_get (&cancel_key);
> +    if (nfo == NULL)
> +    {
> +        /* Main thread - cannot be cancelled anyway */
> +        return WaitForMultipleObjects (count, handles, FALSE, delay);
> +    }

If you collapsed vlc_cancelable_wait into WaitForMultipleObjectsEx, you could 
factor that, and the non alertable case, right?

> +    HANDLE new_handles[count + 1];
> +    if (count > 0)

This check is not needed.

> +    /* We do not support the bWaitAll case */
> +    if (bAlertable && ! bWaitAll)

Should probably assert(!(bAlertable && bWaitAll)).


Anyway, looks pretty good to me.

-- 
Rémi Denis-Courmont



More information about the vlc-devel mailing list