[vlc-commits] win32: move thread priority init to vlc_thread_setup()

Rémi Denis-Courmont git at videolan.org
Sun Jun 18 17:47:17 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jun 18 16:10:51 2017 +0300| [d0c4c5a9072c779bbec89a0600caf31e279478cd] | committer: Rémi Denis-Courmont

win32: move thread priority init to vlc_thread_setup()

Fixes serialization.

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

 src/win32/specific.c | 17 -----------------
 src/win32/thread.c   | 26 ++++++++++++++++++++++----
 2 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/src/win32/specific.c b/src/win32/specific.c
index 31d40af844..aa444bf3bc 100644
--- a/src/win32/specific.c
+++ b/src/win32/specific.c
@@ -97,23 +97,6 @@ typedef struct
 void system_Configure( libvlc_int_t *p_this, int i_argc, const char *const ppsz_argv[] )
 {
 #if !VLC_WINSTORE_APP
-    /* Raise default priority of the current process */
-#ifndef ABOVE_NORMAL_PRIORITY_CLASS
-#   define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
-#endif
-    if( var_InheritBool( p_this, "high-priority" ) )
-    {
-        if( SetPriorityClass( GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS )
-             || SetPriorityClass( GetCurrentProcess(), HIGH_PRIORITY_CLASS ) )
-        {
-            msg_Dbg( p_this, "raised process priority" );
-        }
-        else
-        {
-            msg_Dbg( p_this, "could not raise process priority" );
-        }
-    }
-
     if( var_InheritBool( p_this, "one-instance" )
      || ( var_InheritBool( p_this, "one-instance-when-started-from-file" )
        && var_InheritBool( p_this, "started-from-file" ) ) )
diff --git a/src/win32/thread.c b/src/win32/thread.c
index 17b3654532..9a6b6549ef 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -987,12 +987,30 @@ static CRITICAL_SECTION setup_lock; /* FIXME: use INIT_ONCE */
 void vlc_threads_setup(libvlc_int_t *vlc)
 {
     EnterCriticalSection(&setup_lock);
-    if (mdate_selected == mdate_default)
+    if (mdate_selected != mdate_default)
     {
-        if (!SelectClockSource((vlc != NULL) ? VLC_OBJECT(vlc) : NULL))
-            abort();
-        assert(mdate_selected != mdate_default);
+        LeaveCriticalSection(&setup_lock);
+        return;
+    }
+
+    if (!SelectClockSource((vlc != NULL) ? VLC_OBJECT(vlc) : NULL))
+        abort();
+    assert(mdate_selected != mdate_default);
+
+#if !VLC_WINSTORE_APP
+    /* Raise default priority of the current process */
+#ifndef ABOVE_NORMAL_PRIORITY_CLASS
+#   define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
+#endif
+    if (var_InheritBool(vlc, "high-priority"))
+    {
+        if (SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS)
+         || SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS))
+            msg_Dbg(vlc, "raised process priority");
+        else
+            msg_Dbg(vlc, "could not raise process priority");
     }
+#endif
     LeaveCriticalSection(&setup_lock);
 }
 



More information about the vlc-commits mailing list