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

Steve Lhomme git at videolan.org
Thu Jun 2 19:15:43 CEST 2016


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Mon May 23 17:28:11 2016 +0200| [c554ca3ee3189a773e2569033886c5ea9ecdedd9] | 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=c554ca3ee3189a773e2569033886c5ea9ecdedd9
---

 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 4236675..bb9eee9 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