[vlc-devel] [PATCH 18/18] Fix the problem that mwait() and msleep() do not work in a main thread and an alien thread

KO Myung-Hun komh at chollian.net
Sat Oct 22 08:28:01 CEST 2011


---
 src/os2/thread.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/os2/thread.c b/src/os2/thread.c
index 41b68d4..197ca01 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -72,8 +72,13 @@ static ULONG vlc_DosWaitEventSemEx( HEV hev, ULONG ulTimeout, BOOL fCancelable )
     struct vlc_thread *th = vlc_threadvar_get( thread_key );
     if( th == NULL || !fCancelable )
     {
-        /* Main thread - cannot be cancelled anyway */
-        return DosWaitEventSem( hev, ulTimeout );
+        /* Main thread - cannot be cancelled anyway
+         * Alien thread - out of our control
+         */
+        if( hev != NULLHANDLE )
+            return DosWaitEventSem( hev, ulTimeout );
+
+        return DosSleep( ulTimeout );
     }
 
     n = 0;
-- 
1.7.3.2



More information about the vlc-devel mailing list