[vlc-devel] commit: Fixed vlc_cond_timedwait for win32. (Laurent Aimar )

git version control git at videolan.org
Sun Sep 7 17:15:20 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Sep  7 17:17:06 2008 +0200| [ecabf5dd58521b1e4d81a25623bf310afcff923a] | committer: Laurent Aimar 

Fixed vlc_cond_timedwait for win32.

Windows API expect a timeout in millisecond.
SignaObjectAndWait should properly work with a 0 timeout, so try it.
(avoid an invalid lock and an uninitialized return value).

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

 include/vlc_threads.h |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 7a265b0..c61f6a9 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -447,9 +447,10 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
     {
         vlc_testcancel ();
 
-        mtime_t total = deadline - mdate ();
-        if (total <= 0)
-            break;
+        mtime_t total = (deadline - mdate ())/1000;
+        if( total < 0 )
+            total = 0;
+
         DWORD delay = (total > 0x7fffffff) ? 0x7fffffff : total;
         result = SignalObjectAndWait (*p_mutex, *p_condvar, delay, TRUE);
     }




More information about the vlc-devel mailing list