[vlc-devel] [RFC v2 0/2] New executor API

Alexandre Janniaux ajanni at videolabs.io
Wed Sep 2 21:20:32 CEST 2020


Hi,

On Wed, Sep 02, 2020 at 09:01:32PM +0300, Rémi Denis-Courmont wrote:
> Le keskiviikkona 2. syyskuuta 2020, 8.40.54 EEST Steve Lhomme a écrit :
> > >   - vlc_executor_Cancel() just dequeues a runnable not "started" yet
> > >
> > > Note that vlc_executor_Cancel() now returns a boolean to indicate if the
> > > runnable has been dequeued (it was not started yet) or not (it was
> > > started, so it is running or execution is complete). This is necessary
> > > for the caller to know if it must expect run() to be called (and
> > > typically decide to delete its task or not).
> >
> > It sounds like a race condition that must be handled by the caller.
>
> There is an intrinsic race condition here, and the boolean allows the caller
> to deal with both scenarii. Without the boolean, the caller cannot know if the
> task will run or not, and thus if it needs to wait for it to finish/abort or
> not.
>
> The alternative is to require that _Cancel() waits on completion if the task
> is already running, but that might be undesirable in some cases.

Another alternative would be to add a destructor to the task,
but then its state cannot be reused and it's useless in most
cases.

Regards,
--
Alexandre Janniaux
Videolabs


More information about the vlc-devel mailing list