[vlc-devel] [RFCv2] Thread cancellation on WinCE
Pierre Ynard
linkfanel at yahoo.fr
Thu Nov 20 16:58:43 CET 2008
> > +# define VLC_CANCEL_INIT { NULL, true, false, NULL }
>
> NULL is the error case for HANDLE?
Yes.
> > +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?
Yes, I could factor the call to WaitForMultipleObjects with a goto.
However, it seems cleaner this way, and I wasn't sure whether these
replacement functions should be exported or something, and if so, how.
> > + HANDLE new_handles[count + 1];
> > + if (count > 0)
>
> This check is not needed.
My memcpy manpage doesn't document calling it with a 0 size and a NULL
source pointer :/ But if you're sure, right, I'll remove it.
> > + /* We do not support the bWaitAll case */
> > + if (bAlertable && ! bWaitAll)
>
> Should probably assert(!(bAlertable && bWaitAll)).
Okay. Thanks!
--
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."
More information about the vlc-devel
mailing list