[vlc-commits] Win32: support vlc_cond_wait() with a static mutex

Rémi Denis-Courmont git at videolan.org
Thu Aug 18 16:47:31 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug 18 17:47:16 2011 +0300| [ffe5a11fe468ac9825b939e3fc1d64fc8fe9960d] | committer: Rémi Denis-Courmont

Win32: support vlc_cond_wait() with a static mutex

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

 src/win32/thread.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/win32/thread.c b/src/win32/thread.c
index 0623619..17ca410 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -281,13 +281,12 @@ void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
 {
     DWORD result;
 
-    assert (p_mutex->dynamic); /* TODO */
     do
     {
         vlc_testcancel ();
-        LeaveCriticalSection (&p_mutex->mutex);
+        vlc_mutex_unlock (p_mutex);
         result = vlc_WaitForSingleObject (p_condvar->handle, INFINITE);
-        EnterCriticalSection (&p_mutex->mutex);
+        vlc_mutex_lock (p_mutex);
     }
     while (result == WAIT_IO_COMPLETION);
 
@@ -299,7 +298,6 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
 {
     DWORD result;
 
-    assert (p_mutex->dynamic); /* TODO */
     do
     {
         vlc_testcancel ();
@@ -320,9 +318,9 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
             total = 0;
 
         DWORD delay = (total > 0x7fffffff) ? 0x7fffffff : total;
-        LeaveCriticalSection (&p_mutex->mutex);
+        vlc_mutex_unlock (p_mutex);
         result = vlc_WaitForSingleObject (p_condvar->handle, delay);
-        EnterCriticalSection (&p_mutex->mutex);
+        vlc_mutex_lock (p_mutex);
     }
     while (result == WAIT_IO_COMPLETION);
 



More information about the vlc-commits mailing list