[vlc-devel] [PATCH 3/6] preparser: use vlc_executor_t

Romain Vimont rom1v at videolabs.io
Tue Sep 8 10:33:35 CEST 2020


On Tue, Sep 08, 2020 at 09:42:38AM +0200, Steve Lhomme wrote:
> On 2020-09-07 17:40, Romain Vimont wrote:
> > Replace the background_worker by an executor.
> > ---
> >   src/preparser/preparser.c | 401 ++++++++++++++++++++++++--------------
> >   1 file changed, 251 insertions(+), 150 deletions(-)
> > 
> > diff --git a/src/preparser/preparser.c b/src/preparser/preparser.c
> > index 723feb96dc..78fd31a626 100644
> > --- a/src/preparser/preparser.c
> > +++ b/src/preparser/preparser.c
> > @@ -24,8 +24,8 @@
> >   #include <vlc_common.h>
> >   #include <vlc_atomic.h>
> > +#include <vlc_executor.h>
> > -#include "misc/background_worker.h"
> >   #include "input/input_interface.h"
> >   #include "input/input_internal.h"
> >   #include "preparser.h"
> > @@ -35,222 +35,299 @@ struct input_preparser_t
> >   {
> >       vlc_object_t* owner;
> >       input_fetcher_t* fetcher;
> > -    struct background_worker* worker;
> > +    vlc_executor_t *executor;
> > +    vlc_tick_t default_timeout;
> >       atomic_bool deactivated;
> > +
> > +    vlc_mutex_t lock;
> > +    struct vlc_list submitted_tasks; /**< list of struct task */
> 
> I understand the goal of the executor API is to be simpler that the
> background worker but...

The background worker managed:
 - the execution
 - the timeout
 - the cancelation calls (even if the impl was provided by the caller)

The executor only manages the execution.

> ..this is a lot of error-prone boilerplate code that has to be written in
> all executor users.

Yes, that was my point here:
https://mailman.videolan.org/pipermail/vlc-devel/2020-August/136801.html

I do like a minimal executor, but yes there is a gap with what
preparser/thumbnailer need.

Regards


More information about the vlc-devel mailing list