[vlc-devel] [PATCH 3/3] win32: we never wait for more than one object at a time
Steve Lhomme
robux4 at videolabs.io
Mon May 23 17:28:11 CEST 2016
---
src/win32/thread.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/win32/thread.c b/src/win32/thread.c
index c4efd57..5b00261 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -69,8 +69,7 @@ struct vlc_thread
static bool isCancelled(void);
#endif
-static DWORD vlc_WaitForMultipleObjects (DWORD count, const HANDLE *handles,
- DWORD delay)
+static DWORD vlc_WaitForSingleObjectEx( HANDLE handle, DWORD delay )
{
DWORD ret;
#if !IS_INTERRUPTIBLE
@@ -78,18 +77,18 @@ 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! */
@@ -98,7 +97,7 @@ static DWORD vlc_WaitForMultipleObjects (DWORD count, const HANDLE *handles,
static DWORD vlc_WaitForSingleObject (HANDLE handle, DWORD delay)
{
- return vlc_WaitForMultipleObjects (1, &handle, delay);
+ return vlc_WaitForSingleObjectEx( handle, delay );
}
static DWORD vlc_Sleep (DWORD delay)
--
2.7.2.windows.1
More information about the vlc-devel
mailing list