[vlc-commits] Fix FreeBSD threading

Rafaël Carré git at videolan.org
Wed Jan 4 19:30:48 CET 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed Jan  4 13:29:52 2012 -0500| [86ebcf5f366ce9f15ee3b5025af5d13b108321d0] | committer: Rafaël Carré

Fix FreeBSD threading

pthread_condattr_setclock() works and supports MONOTONIC_CLOCK
pthread_cond_timedwait() can thus use MONOTONIC_CLOCK

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

 src/posix/thread.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/posix/thread.c b/src/posix/thread.c
index 122e201..02a3f23 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -352,7 +352,7 @@ void vlc_cond_init (vlc_cond_t *p_condvar)
     vlc_clock_setup ();
     if (unlikely(pthread_condattr_init (&attr)))
         abort ();
-#if (_POSIX_CLOCK_SELECTION > 0)
+#if (_POSIX_CLOCK_SELECTION > 0) || defined(__FreeBSD__)
     pthread_condattr_setclock (&attr, vlc_clock_id);
 #endif
     if (unlikely(pthread_cond_init (p_condvar, &attr)))
@@ -457,7 +457,7 @@ 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)
+#if (_POSIX_MONOTONIC_CLOCK > 0) && (_POSIX_CLOCK_SELECTION < 0) && !defined(__FreeBSD__)
     /* 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()



More information about the vlc-commits mailing list