[vlc-commits] timer: match documentation for vlc_timer_schedule()

Rémi Denis-Courmont git at videolan.org
Wed Aug 17 14:19:50 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Aug 17 14:38:02 2016 +0300| [3fc9abf733b61f27cd4bf39dd6fc29174779aefc] | committer: Rémi Denis-Courmont

timer: match documentation for vlc_timer_schedule()

The timer interval is irrelevant if the deadline is zero, meaning
to disarm the timer.

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

 src/posix/timer.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/posix/timer.c b/src/posix/timer.c
index d170666..698f486 100644
--- a/src/posix/timer.c
+++ b/src/posix/timer.c
@@ -60,7 +60,10 @@ static void *vlc_timer_thread (void *data)
     for (;;)
     {
         while (timer->value == 0)
+        {
+            assert(timer->interval == 0);
             vlc_cond_wait (&timer->reschedule, &timer->lock);
+        }
 
         if (vlc_cond_timedwait (&timer->reschedule, &timer->lock,
                                 timer->value) == 0)
@@ -138,7 +141,10 @@ void vlc_timer_destroy (vlc_timer_t timer)
 void vlc_timer_schedule (vlc_timer_t timer, bool absolute,
                          mtime_t value, mtime_t interval)
 {
-    if (!absolute && value != 0)
+    if (value == 0)
+        interval = 0;
+    else
+    if (!absolute)
         value += mdate();
 
     vlc_mutex_lock (&timer->lock);



More information about the vlc-commits mailing list