[vlc-commits] win32: provide vlc_addr_*() functions
Rémi Denis-Courmont
git at videolan.org
Fri May 27 23:43:03 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May 26 22:32:03 2016 +0300| [c47ade6b66deca610f102969877a589dcee0691a] | committer: Rémi Denis-Courmont
win32: provide vlc_addr_*() functions
Where available, use WaitOnAddress(), WakeByAddressSingle(), and
WakeByAddressAll(). They map almost directly.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c47ade6b66deca610f102969877a589dcee0691a
---
src/win32/thread.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/win32/thread.c b/src/win32/thread.c
index 8df74c8..676ff48 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -1,7 +1,7 @@
/*****************************************************************************
* thread.c : Win32 back-end for LibVLC
*****************************************************************************
- * Copyright (C) 1999-2009 VLC authors and VideoLAN
+ * Copyright (C) 1999-2016 VLC authors and VideoLAN
*
* Authors: Jean-Marc Dressler <polux at via.ecp.fr>
* Samuel Hocevar <sam at zoy.org>
@@ -440,6 +440,39 @@ retry:
vlc_mutex_unlock(&super_mutex);
}
+/*** Futeces^WAddress waits ***/
+
+#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
+void vlc_addr_wait(void *addr, int val)
+{
+ WaitOnAddress(addr, &val, sizeof (val), -1);
+}
+
+bool vlc_addr_timedwait(void *addr, int val, mtime_t delay)
+{
+ delay = (delay + 999) / 1000;
+
+ if (delay > 0x7fffffff)
+ {
+ WaitOnAddress(addr, &val, sizeof (val), 0x7fffffff);
+ return true; /* woke up early, claim spurious wake-up */
+ }
+
+ return WaitOnAddress(addr, &val, sizeof (val), delay);
+}
+
+void vlc_addr_signal(void *addr)
+{
+ WakeByAddressSingle(addr);
+}
+
+void vlc_addr_broadcast(void *addr)
+{
+ WakeByAddressAll(addr);
+}
+#endif
+
+/*** Threads ***/
#if !IS_INTERRUPTIBLE
static bool isCancelled(void)
{
More information about the vlc-commits
mailing list