[vlc-commits] block: add vlc_fifo_TimedWaitCond

Thomas Guillem git at videolan.org
Sat Dec 5 13:21:06 CET 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sat Dec  5 13:08:20 2015 +0100| [2a8b955ae1fe123c263a438490ca4e2d4c79501b] | committer: Thomas Guillem

block: add vlc_fifo_TimedWaitCond

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2a8b955ae1fe123c263a438490ca4e2d4c79501b
---

 include/vlc_block.h |    1 +
 src/misc/fifo.c     |    9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/include/vlc_block.h b/include/vlc_block.h
index 59d7556..908d2c4 100644
--- a/include/vlc_block.h
+++ b/include/vlc_block.h
@@ -326,6 +326,7 @@ 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 *);
+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/misc/fifo.c b/src/misc/fifo.c
index 789690e..efcc0f0 100644
--- a/src/misc/fifo.c
+++ b/src/misc/fifo.c
@@ -111,6 +111,15 @@ 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_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.



More information about the vlc-commits mailing list