[vlc-commits] win32: thread: Use QueueUserAPC on Windows 10

Hugo Beauzée-Luyssen git at videolan.org
Tue May 10 20:27:55 CEST 2016


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Apr  6 17:56:18 2016 +0200| [ae5cb8f2dfb472c6afd677f86a8c8f0845c00d65] | committer: Hugo Beauzée-Luyssen

win32: thread: Use QueueUserAPC on Windows 10

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

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

diff --git a/src/win32/thread.c b/src/win32/thread.c
index 774d4db..1338308 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -43,9 +43,10 @@
 static vlc_mutex_t super_mutex;
 static vlc_cond_t  super_variable;
 
+#define IS_INTERRUPTIBLE (!VLC_WINSTORE_APP || _WIN32_WINNT >= 0x0A00)
 
 /*** Common helpers ***/
-#if VLC_WINSTORE_APP
+#if !IS_INTERRUPTIBLE
 static bool isCancelled(void);
 #endif
 
@@ -55,7 +56,7 @@ static DWORD vlc_WaitForMultipleObjects (DWORD count, const HANDLE *handles,
     DWORD ret;
     if (count == 0)
     {
-#if VLC_WINSTORE_APP
+#if !IS_INTERRUPTIBLE
         do {
             DWORD new_delay = 50;
             if (new_delay > delay)
@@ -74,7 +75,7 @@ static DWORD vlc_WaitForMultipleObjects (DWORD count, const HANDLE *handles,
             ret = WAIT_TIMEOUT;
     }
     else {
-#if VLC_WINSTORE_APP
+#if !IS_INTERRUPTIBLE
         do {
             DWORD new_delay = 50;
             if (new_delay > delay)
@@ -448,7 +449,7 @@ struct vlc_thread
     HANDLE         id;
 
     bool           killable;
-#if !VLC_WINSTORE_APP
+#if IS_INTERRUPTIBLE
     bool           killed;
 #else
     atomic_bool    killed;
@@ -459,7 +460,7 @@ struct vlc_thread
     void          *data;
 };
 
-#if VLC_WINSTORE_APP
+#if !IS_INTERRUPTIBLE
 static bool isCancelled(void)
 {
     struct vlc_thread *th = TlsGetValue(thread_key);
@@ -493,7 +494,7 @@ static int vlc_clone_attr (vlc_thread_t *p_handle, bool detached,
     th->entry = entry;
     th->data = data;
     th->killable = false; /* not until vlc_entry() ! */
-#if !VLC_WINSTORE_APP
+#if IS_INTERRUPTIBLE
     th->killed = false;
 #else
     atomic_init(&th->killed, false);
@@ -566,7 +567,7 @@ int vlc_set_priority (vlc_thread_t th, int priority)
 
 /*** Thread cancellation ***/
 
-#if !VLC_WINSTORE_APP
+#if IS_INTERRUPTIBLE
 /* APC procedure for thread cancellation */
 static void CALLBACK vlc_cancel_self (ULONG_PTR self)
 {
@@ -579,7 +580,7 @@ static void CALLBACK vlc_cancel_self (ULONG_PTR self)
 
 void vlc_cancel (vlc_thread_t th)
 {
-#if !VLC_WINSTORE_APP
+#if IS_INTERRUPTIBLE
     QueueUserAPC (vlc_cancel_self, th->id, (uintptr_t)th);
 #else
     atomic_store (&th->killed, true);
@@ -616,7 +617,7 @@ void vlc_testcancel (void)
         return; /* Main thread - cannot be cancelled anyway */
     if (!th->killable)
         return;
-#if !VLC_WINSTORE_APP
+#if IS_INTERRUPTIBLE
     if (likely(!th->killed))
         return;
 #else



More information about the vlc-commits mailing list