[vlc-devel] [RFC 1/2] executor: introduce new executor API

Rémi Denis-Courmont remi at remlab.net
Wed Aug 26 22:34:04 CEST 2020


Le keskiviikkona 26. elokuuta 2020, 23.11.08 EEST Romain Vimont a écrit :
> > > +/**
> > > + * Make sure that an interrupt thread is running and will consider the
> > > + * interruption for a new task just added.
> > > + */
> > > +static int
> > > +RequireInterruptThread(vlc_executor_t *executor)
> > > +{
> > > +    vlc_mutex_assert(&executor->lock);
> > > +
> > > +    if (executor->interrupt_thread_running)
> > > +        vlc_cond_signal(&executor->interrupt_wait);
> > > +    else
> > > +    {
> > > +        if (vlc_clone_detach(NULL, InterruptThreadRun, executor,
> > > +                             VLC_THREAD_PRIORITY_LOW))
> > 
> > Detached threads cannot be safe in dynamically linked LibVLC. There's a
> > risk that LibVLC will be unloaded before the thread exits, crashing the
> > process.
> In vlc_executor_Delete(), the threads are awaited via a condition
> variable (nothreads_wait).

So what? Even vlc_cond_t code is in LibVLC, as is the code that handles the 
return.

Windows has FreeLibraryAndExitThread() to address this problem, but it's hard 
to use and POSIX has no equivalent.

-- 
レミ・デニ-クールモン
http://www.remlab.net/





More information about the vlc-devel mailing list