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

Romain Vimont rom1v at videolabs.io
Wed Sep 2 10:36:13 CEST 2020


On Wed, Sep 02, 2020 at 07:40:54AM +0200, Steve Lhomme wrote:
> On 2020-09-01 18:13, Romain Vimont wrote:
> > The first RFC is here:
> > https://mailman.videolan.org/pipermail/vlc-devel/2020-August/136696.html
> > 
> > It generated a lot of design discussions (thank you all).
> > 
> > Here is a new proposal, attempting to take the review comments into account.
> > 
> > In this new version, the executor is "minimal":
> >   - it is not concerned by task interruption
> >   - it does not handle timeout
> >   - vlc_executor_Submit() returns void (at the cost of a "struct vlc_list node"
> >     field in the public struct vlc_runnable)
> >   - 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. The
> result may say the task is running but when it's time to remove the task or
> to discard the result, it has already finished.

The bool only indicates if the task was still in the pending queue (so
it is removed an run() will not be called) or already taken by an
executor thread (so run() has been or will be called, finished or not).

> 
> > Now, the preparser:
> >   - manages the list of the tasks it submitted to the executor
> >   - handles cancelation/interruption
> >   - handles timeout "manually" in its run() function
> > 
> > Thank you for your feedbacks ;)
> > 
> > Here is a branch: https://code.videolan.org/rom1v/vlc/commits/executor.rfc2
> > 
> > Romain Vimont (2):
> >    executor: introduce new executor API
> >    preparser: use the new executor API
> > 
> >   include/vlc_executor.h    | 149 ++++++++++++++
> >   src/Makefile.am           |   1 +
> >   src/libvlccore.sym        |   4 +
> >   src/misc/executor.c       | 263 +++++++++++++++++++++++++
> >   src/preparser/preparser.c | 399 ++++++++++++++++++++++++--------------
> >   5 files changed, 668 insertions(+), 148 deletions(-)
> >   create mode 100644 include/vlc_executor.h
> >   create mode 100644 src/misc/executor.c
> > 
> > -- 
> > 2.28.0
> > 
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> > 
> _______________________________________________
> 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