[vlc-devel] [RFC PATCH 1/2] block: add vlc_fifo_TimedWait and vlc_fifo_TimedWaitCond

Thomas Guillem thomas at gllm.fr
Fri Dec 4 09:01:36 CET 2015



On Thu, Dec 3, 2015, at 19:23, Rémi Denis-Courmont wrote:
> On Monday 30 November 2015 18:00:47 Thomas Guillem wrote:
> > ---
> >  include/vlc_block.h |  2 ++
> >  src/libvlccore.sym  |  2 ++
> >  src/misc/fifo.c     | 14 ++++++++++++++
> >  3 files changed, 18 insertions(+)
> > 
> > diff --git a/include/vlc_block.h b/include/vlc_block.h
> > index 59d7556..8af45f4 100644
> > --- a/include/vlc_block.h
> > +++ b/include/vlc_block.h
> > @@ -326,6 +326,8 @@ VLC_API void vlc_fifo_Unlock(vlc_fifo_t *);
> >  VLC_API void vlc_fifo_Signal(vlc_fifo_t *);
> >  VLC_API void vlc_fifo_Wait(vlc_fifo_t *);
> >  VLC_API void vlc_fifo_WaitCond(vlc_fifo_t *, vlc_cond_t *);
> > +VLC_API int vlc_fifo_TimedWait(vlc_fifo_t *, mtime_t);
> > +VLC_API int vlc_fifo_TimedWaitCond(vlc_fifo_t *, vlc_cond_t *, mtime_t);
> >  VLC_API void vlc_fifo_QueueUnlocked(vlc_fifo_t *, block_t *);
> >  VLC_API block_t *vlc_fifo_DequeueUnlocked(vlc_fifo_t *) VLC_USED;
> >  VLC_API block_t *vlc_fifo_DequeueAllUnlocked(vlc_fifo_t *) VLC_USED;
> > diff --git a/src/libvlccore.sym b/src/libvlccore.sym
> > index 95152e8..1985ca6 100644
> > --- a/src/libvlccore.sym
> > +++ b/src/libvlccore.sym
> > @@ -637,6 +637,8 @@ vlc_fifo_Unlock
> >  vlc_fifo_Signal
> >  vlc_fifo_Wait
> >  vlc_fifo_WaitCond
> > +vlc_fifo_TimedWait
> > +vlc_fifo_TimedWaitCond
> 
> Not needed, AFAICT.

Then, I sould remove VLC_API pefrix

> 
> >  vlc_fifo_QueueUnlocked
> >  vlc_fifo_DequeueUnlocked
> >  vlc_fifo_DequeueAllUnlocked
> > diff --git a/src/misc/fifo.c b/src/misc/fifo.c
> > index 789690e..132893e 100644
> > --- a/src/misc/fifo.c
> > +++ b/src/misc/fifo.c
> > @@ -111,6 +111,20 @@ void vlc_fifo_WaitCond(vlc_fifo_t *fifo, vlc_cond_t
> > *condvar) }
> > 
> >  /**
> > + * Atomically unlocks the FIFO and waits until one thread signals the FIFO
> > up + * to a certain date, then locks the FIFO again. See vlc_fifo_Wait(). +
> > */
> > +int vlc_fifo_TimedWait(vlc_fifo_t *fifo, mtime_t deadline)
> > +{
> > +    return vlc_fifo_TimedWaitCond(fifo, &fifo->wait, deadline);
> > +}
> 
> Dead code?

Why ? Because it's not called yet ?

> 
> > +
> > +int vlc_fifo_TimedWaitCond(vlc_fifo_t *fifo, vlc_cond_t *condvar, mtime_t
> > deadline) +{
> > +    return vlc_cond_timedwait(condvar, &fifo->lock, deadline);
> > +}
> > +
> > +/**
> >   * Checks how many blocks are queued in a locked FIFO.
> >   *
> >   * @note This function is not cancellation point.
> 
> -- 
> Rémi Denis-Courmont
> http://www.remlab.net/
> 
> _______________________________________________
> 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