[vlc-devel] [PATCH 1/2] win32: add cancel functions to be called in the APC
Rémi Denis-Courmont
remi at remlab.net
Sun Jan 17 14:36:33 CET 2016
On Sunday 17 January 2016 14:17:47 Steve Lhomme wrote:
> On Sat, Jan 16, 2016 at 6:34 PM, Rémi Denis-Courmont <remi at remlab.net>
wrote:
> > On Friday 15 January 2016 17:16:21 Steve Lhomme wrote:
> >> --
> >> this is going to be useful to cancel socket tasks that are not alertable
> >
> > That makes no sense. If the waiting function cannot be alerted, the
> > asynchronous procedure callback won´t be invoked. We already have
> > cancellation cleanup handlers then.
>
> Maybe I did not use the right term. select() does let the cancel APC
> run. But unlike WSAWaitForMultipleEvents(), it doesn't exit (with
> WSA_WAIT_IO_COMPLETION) when after the APC is run. So the infinite
> wait just sits there.
>
> That's why in patch 2/2 I use an extra UDP socket that is canceled
> during the APC, thus making select() exit as we want.
Winsock is not supposed to be re-entrant, so this is undefined.
Besides, INET sockets bring a variety of failure cases that make them
unsuitable as a reliable intra-process wake-up mechanism.
> This seems to be
> a common solution:
> http://stackoverflow.com/questions/3333361/how-to-cancel-waiting-in-select-o
> n-windows
Just FYI, stackoverflow.com is not exactly what I would call a reliable source
of information. Regardless, that page suggests calling send() from *another*
thread. Big deal.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list