[vlc-commits] win32: we never wait for more than one object at a time

Steve Lhomme git at videolan.org
Wed Jun 1 21:57:09 CEST 2016


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Mon May 23 17:28:11 2016 +0200| [83331779d4f4a5b894dfc5c414ab8fb40961d033] | committer: Rémi Denis-Courmont

win32: we never wait for more than one object at a time

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

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

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

diff --git a/src/win32/thread.c b/src/win32/thread.c
index 1880cf6..9efd45c 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -71,8 +71,7 @@ struct vlc_thread
 static bool isCancelled(void);
 #endif
 
-static DWORD vlc_WaitForMultipleObjects (DWORD count, const HANDLE *handles,
-                                         DWORD delay)
+static DWORD vlc_WaitForSingleObject(HANDLE handle, DWORD delay)
 {
     DWORD ret;
 #if !IS_INTERRUPTIBLE
@@ -80,29 +79,24 @@ static DWORD vlc_WaitForMultipleObjects (DWORD count, const HANDLE *handles,
             DWORD new_delay = 50;
             if (new_delay > delay)
                 new_delay = delay;
-            ret = WaitForMultipleObjectsEx (count, handles, FALSE, new_delay, TRUE);
+            ret = WaitForSingleObjectEx(handle, new_delay, TRUE);
             if (delay != INFINITE)
                 delay -= new_delay;
             if (isCancelled())
                 ret = WAIT_IO_COMPLETION;
         } while (delay && ret == WAIT_TIMEOUT);
 #else
-        ret = WaitForMultipleObjectsEx (count, handles, FALSE, delay, TRUE);
+    ret = WaitForSingleObjectEx(handle, delay, TRUE);
 #endif
 
     /* We do not abandon objects... this would be a bug */
-    assert (ret < WAIT_ABANDONED_0 || WAIT_ABANDONED_0 + count - 1 < ret);
+    assert(ret != WAIT_ABANDONED_0);
 
     if (unlikely(ret == WAIT_FAILED))
         abort (); /* We are screwed! */
     return ret;
 }
 
-static DWORD vlc_WaitForSingleObject (HANDLE handle, DWORD delay)
-{
-    return vlc_WaitForMultipleObjects (1, &handle, delay);
-}
-
 
 /*** Mutexes ***/
 void vlc_mutex_init( vlc_mutex_t *p_mutex )



More information about the vlc-commits mailing list