[vlc-devel] [RFC 0/2] New executor API
Romain Vimont
rom1v at videolabs.io
Thu Aug 27 17:50:29 CEST 2020
On Thu, Aug 27, 2020 at 05:47:49PM +0300, Rémi Denis-Courmont wrote:
> Le torstaina 27. elokuuta 2020, 17.32.10 EEST Romain Vimont a écrit :
> > Yes, but vlc_executor_Cancel() may "interrupt" the task at any time, so
> > you have to handle it anyway (timeout or not).
>
> That's never going to work, unless the runnable has its own killable process
> (which should be had for other reasons, notably I/O scheduling).
I don't understand why you say it can't work.
Canceling a runnable does work. This is already what
background_worker_Cancel() provides, and with the vlc_executor_t it
calls the interrupt() callback:
https://code.videolan.org/rom1v/vlc/-/blob/74b4f0f4e3c91dfa9b2b38aef9216073383cba92/include/vlc_executor.h#L72
Here is the current implementation for the preparser:
https://code.videolan.org/rom1v/vlc/-/blob/74b4f0f4e3c91dfa9b2b38aef9216073383cba92/src/preparser/preparser.c#L225-233
This allows to "interrupt" the preparsing in the run():
https://code.videolan.org/rom1v/vlc/-/blob/74b4f0f4e3c91dfa9b2b38aef9216073383cba92/src/preparser/preparser.c#L179-184
That way, the same mechanism is used for both cancelation and timeout
(there is nothing more to do for the user of executor).
Being able to cancel tasks is a major feature of the executor.
Cancelation is currently used by all users of background worker
(preparser, fetcher, thumbnailer).
IMO, that would not make sense to remove this feature from the executor
and reimplement it several times separately.
More information about the vlc-devel
mailing list