[vlc-commits] Do not use the monotonic clock if CS is missing
Rémi Denis-Courmont
git at videolan.org
Thu Feb 23 19:15:15 CET 2012
vlc/vlc-2.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jan 4 21:10:50 2012 +0200| [77bcce1ef1ac4627fa632825fa3718081117f3a1] | committer: Jean-Baptiste Kempf
Do not use the monotonic clock if CS is missing
This can happen on some POSIX.2001 systems.
(cherry picked from commit 46f74073685b29544dd55b3494f82e77fe9b4b6b)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=77bcce1ef1ac4627fa632825fa3718081117f3a1
---
src/posix/thread.c | 18 ++----------------
1 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/src/posix/thread.c b/src/posix/thread.c
index 1d0d077..f34620f 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -76,11 +76,11 @@
#if (_POSIX_TIMERS > 0)
static unsigned vlc_clock_prec;
-# if (_POSIX_MONOTONIC_CLOCK > 0)
+# if (_POSIX_MONOTONIC_CLOCK > 0) && (_POSIX_CLOCK_SELECTION > 0)
/* Compile-time POSIX monotonic clock support */
# define vlc_clock_id (CLOCK_MONOTONIC)
-# elif (_POSIX_MONOTONIC_CLOCK == 0)
+# elif (_POSIX_MONOTONIC_CLOCK == 0) && (_POSIX_CLOCK_SELECTION > 0)
/* Run-time POSIX monotonic clock support (see clock_setup() below) */
static clockid_t vlc_clock_id;
@@ -450,20 +450,6 @@ void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
mtime_t deadline)
{
-#if (_POSIX_MONOTONIC_CLOCK > 0) && (_POSIX_CLOCK_SELECTION < 0)
- /* Without clock selection, the real-time clock is used for the absolute
- * timeout in pthread_cond_timedwait(). We may need to adjust. */
-# error FIXME: breaks vlc_cond_init_daytime()
- if (vlc_clock_id != CLOCK_REALTIME)
- {
- struct timeval tv;
-
- deadline -= mdate ();
- gettimeofday (&tv, NULL);
- deadline += tv.tv_sec * UINT64_C(1000000) + tv.tv_usec;
- }
-#endif
-
struct timespec ts = mtime_to_ts (deadline);
int val = pthread_cond_timedwait (p_condvar, p_mutex, &ts);
if (val != ETIMEDOUT)
More information about the vlc-commits
mailing list