[vlc-devel] [PATCH 1/2] win32: add cancel functions to be called in the APC

Steve Lhomme robux4 at gmail.com
Sun Jan 17 14:17:47 CET 2016


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. This seems to be
a common solution:
http://stackoverflow.com/questions/3333361/how-to-cancel-waiting-in-select-on-windows

The way we use events (create/destroy at every call) is prone to lose
events. And in fact I often end up in such case where the code gets
stuck when there's plenty of room (to write).


> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list