瀏覽代碼

LibPthread: Add stubs for pthread_{get,set}schedparam()

These should be the last thing needed to make SDL build with threads
support. I think we can survive just fine with stubs of these for now,
especially given that the kernel doesn't care super much about thread
priorities anyway.
Andreas Kling 5 年之前
父節點
當前提交
96e8c8a4e5
共有 2 個文件被更改,包括 19 次插入0 次删除
  1. 16 0
      Libraries/LibPthread/pthread.cpp
  2. 3 0
      Libraries/LibPthread/pthread.h

+ 16 - 0
Libraries/LibPthread/pthread.cpp

@@ -371,6 +371,22 @@ int pthread_attr_setstacksize(pthread_attr_t* attributes, size_t stack_size)
     return 0;
     return 0;
 }
 }
 
 
+int pthread_getschedparam(pthread_t thread, int* policy, struct sched_param* param)
+{
+    (void)thread;
+    (void)policy;
+    (void)param;
+    return 0;
+}
+
+int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param* param)
+{
+    (void)thread;
+    (void)policy;
+    (void)param;
+    return 0;
+}
+
 struct WaitNode : public InlineLinkedListNode<WaitNode> {
 struct WaitNode : public InlineLinkedListNode<WaitNode> {
     bool waiting { true };
     bool waiting { true };
     WaitNode* m_next { nullptr };
     WaitNode* m_next { nullptr };

+ 3 - 0
Libraries/LibPthread/pthread.h

@@ -46,6 +46,9 @@ int pthread_once(pthread_once_t*, void (*)());
 void* pthread_getspecific(pthread_key_t key);
 void* pthread_getspecific(pthread_key_t key);
 int pthread_setspecific(pthread_key_t key, const void* value);
 int pthread_setspecific(pthread_key_t key, const void* value);
 
 
+int pthread_getschedparam(pthread_t thread, int* policy, struct sched_param* param);
+int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param* param);
+
 #define PTHREAD_MUTEX_NORMAL 0
 #define PTHREAD_MUTEX_NORMAL 0
 #define PTHREAD_MUTEX_RECURSIVE 1
 #define PTHREAD_MUTEX_RECURSIVE 1
 #define PTHREAD_MUTEX_INITIALIZER 0
 #define PTHREAD_MUTEX_INITIALIZER 0