[vlc-devel] [PATCH] [RFC] include: the deadline vlc_cond_timedwait_daytime() is a vlc_tick_t

Steve Lhomme robux4 at ycbcr.xyz
Tue Jul 3 15:45:44 CEST 2018


This is how it's handled on Darwin, when LIBVLC_NEED_CONDVAR is set (Windows?)
and OS/2

On the other hand:
- The POSIX variant seem to assume it's receiving seconds.
- the only call is in vlm.c and passes a value in time_t (seconds).

Not sure which one is correct
---
 include/vlc_threads.h | 2 +-
 src/darwin/thread.c   | 2 +-
 src/misc/threads.c    | 2 +-
 src/os2/thread.c      | 2 +-
 src/posix/thread.c    | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index f1343868a4..1b0a1b8a5b 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -541,7 +541,7 @@ VLC_API void vlc_cond_wait(vlc_cond_t *cond, vlc_mutex_t *mutex);
 VLC_API int vlc_cond_timedwait(vlc_cond_t *cond, vlc_mutex_t *mutex,
                                vlc_tick_t deadline);
 
-int vlc_cond_timedwait_daytime(vlc_cond_t *, vlc_mutex_t *, time_t);
+int vlc_cond_timedwait_daytime(vlc_cond_t *, vlc_mutex_t *, vlc_tick_t deadline);
 
 /**
  * Initializes a semaphore.
diff --git a/src/darwin/thread.c b/src/darwin/thread.c
index 7b0dfdb290..02f39d42b4 100644
--- a/src/darwin/thread.c
+++ b/src/darwin/thread.c
@@ -268,7 +268,7 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
 
 /* variant for vlc_cond_init_daytime */
 int vlc_cond_timedwait_daytime (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
-                                time_t deadline)
+                                vlc_tick_t deadline)
 {
     /*
      * Note that both pthread_cond_timedwait_relative_np and pthread_cond_timedwait
diff --git a/src/misc/threads.c b/src/misc/threads.c
index b34d28add5..0be665f958 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -213,7 +213,7 @@ int vlc_cond_timedwait(vlc_cond_t *cond, vlc_mutex_t *mutex, vlc_tick_t deadline
 }
 
 int vlc_cond_timedwait_daytime(vlc_cond_t *cond, vlc_mutex_t *mutex,
-                               time_t deadline)
+                               vlc_tick_t deadline)
 {
     struct timespec ts;
 
diff --git a/src/os2/thread.c b/src/os2/thread.c
index fe88dd7088..7a84d1b664 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -410,7 +410,7 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
 }
 
 int vlc_cond_timedwait_daytime (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
-                                time_t deadline)
+                                vlc_tick_t deadline)
 {
     ULONG ulTimeout;
     vlc_tick_t total;
diff --git a/src/posix/thread.c b/src/posix/thread.c
index 425bd32b69..ff78f15166 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -235,7 +235,7 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
 }
 
 int vlc_cond_timedwait_daytime (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
-                                time_t deadline)
+                                vlc_tick_t deadline)
 {
     struct timespec ts = { deadline, 0 };
     int val = pthread_cond_timedwait (p_condvar, p_mutex, &ts);
-- 
2.17.0



More information about the vlc-devel mailing list