[vlc-devel] [RFC PATCH 1/2] block: add vlc_fifo_TimedWait and vlc_fifo_TimedWaitCond
Rémi Denis-Courmont
remi at remlab.net
Thu Dec 3 19:23:44 CET 2015
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.
> 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?
> +
> +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/
More information about the vlc-devel
mailing list