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

KO Myung-Hun git at videolan.org
Sat Oct 22 18:12:25 CEST 2011


vlc | branch: master | KO Myung-Hun <komh at chollian.net> | Sat Oct 22 15:28:01 2011 +0900| [ca53307db0a87c54b5364e021d0fa276e956c4b6] | committer: Rémi Denis-Courmont

Fix the problem that mwait() and msleep() do not work in a main thread and an alien thread

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 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;



More information about the vlc-commits mailing list