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

Rémi Denis-Courmont remi at remlab.net
Wed Sep 2 20:01:32 CEST 2020


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.

-- 
Реми Дёни-Курмон
http://www.remlab.net/





More information about the vlc-devel mailing list