瀏覽代碼

Added a note on how to allow non-root applications to increase their thread priority on Linux

Sam Lantinga 9 年之前
父節點
當前提交
741aaf4c80
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/thread/pthread/SDL_systhread.c

+ 4 - 0
src/thread/pthread/SDL_systhread.c

@@ -199,6 +199,10 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
     if (setpriority(PRIO_PROCESS, syscall(SYS_gettid), value) < 0) {
     if (setpriority(PRIO_PROCESS, syscall(SYS_gettid), value) < 0) {
         /* Note that this fails if you're trying to set high priority
         /* Note that this fails if you're trying to set high priority
            and you don't have root permission. BUT DON'T RUN AS ROOT!
            and you don't have root permission. BUT DON'T RUN AS ROOT!
+
+           You can grant the ability to increase thread priority by
+           running the following command on your application binary:
+               sudo setcap 'cap_sys_nice=eip' <application>
          */
          */
         return SDL_SetError("setpriority() failed");
         return SDL_SetError("setpriority() failed");
     }
     }