[vlc-devel] [PATCH 05/11] os2: thread: make VLC_THREAD_PRIORITY_XXX macros constant

KO Myung-Hun komh78 at gmail.com
Wed Jan 20 09:49:27 UTC 2021


This fixes compilation of src/input/decoder.c
and modules/stream_out/transcode/transcode.c.
---
 include/vlc_threads.h | 10 ++++------
 src/os2/thread.c      | 12 ++++++++----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 0aac31afbf..a333f0cd14 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -92,13 +92,11 @@ typedef struct vlc_threadvar *vlc_threadvar_t;
 typedef struct vlc_timer *vlc_timer_t;
 
 # define VLC_THREAD_PRIORITY_LOW      0
-# define VLC_THREAD_PRIORITY_INPUT \
-                                    MAKESHORT(PRTYD_MAXIMUM / 2, PRTYC_REGULAR)
-# define VLC_THREAD_PRIORITY_AUDIO    MAKESHORT(PRTYD_MAXIMUM, PRTYC_REGULAR)
+# define VLC_THREAD_PRIORITY_INPUT    1
+# define VLC_THREAD_PRIORITY_AUDIO    VLC_THREAD_PRIORITY_HIGHEST
 # define VLC_THREAD_PRIORITY_VIDEO    0
-# define VLC_THREAD_PRIORITY_OUTPUT \
-                                    MAKESHORT(PRTYD_MAXIMUM / 2, PRTYC_REGULAR)
-# define VLC_THREAD_PRIORITY_HIGHEST  MAKESHORT(0, PRTYC_TIMECRITICAL)
+# define VLC_THREAD_PRIORITY_OUTPUT   1
+# define VLC_THREAD_PRIORITY_HIGHEST  2
 
 # define pthread_sigmask  sigprocmask
 
diff --git a/src/os2/thread.c b/src/os2/thread.c
index 1c4774f04c..fba569c6f0 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -475,10 +475,14 @@ int vlc_clone (vlc_thread_t *p_handle, void *(*entry) (void *),
         *p_handle = th;
 
     if (priority)
-        DosSetPriority(PRTYS_THREAD,
-                       HIBYTE(priority),
-                       LOBYTE(priority),
-                       th->tid);
+    {
+        LONG delta = PRTYD_MAXIMUM;
+
+        if (priority != VLC_THREAD_PRIORITY_HIGHEST)
+            delta >>= 1;
+
+        DosSetPriority(PRTYS_THREAD, PRTYC_REGULAR, delta, th->tid );
+    }
 
     return 0;
 
-- 
2.22.0



More information about the vlc-devel mailing list