[vlc-devel] [RFC 0/2] New executor API
Pierre Ynard
linkfanel at yahoo.fr
Thu Aug 27 18:14:37 CEST 2020
> > 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 think we're talking about cooperative cancellation here, not
mandatory, relying on cancellation points, or even preemption. The task
checks a condition variable every once in a while - if it processes a
series of items of blocks, then between each block or once in its main
loop - and voluntarily stops further processing there; it can even
return partial results if available and applicable.
This doesn't necessarily make as much sense depending on whether you
envision that the limiting factor demanding interruption will be
processing power / the amount of work to do, or waiting on resources to
become available.
> Not really, no. Cancelation is not the same condition, and it does not
> need a whole thread of its own to trigger.
With what I described above, you can make it use the same condition.
Now, depending on how ambitious the API wants or needs to be, the
arguments that providing timeouts is a useless burden also make sense.
Maybe a middle ground could be that the task framework would provide
the task with a routine that both checks the cancellation condition and
computes and checks expiration of the timeout, but I don't know if it's
viable.
--
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