diff options
-rw-r--r-- | pbxt/fix-low-priority.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/pbxt/fix-low-priority.patch b/pbxt/fix-low-priority.patch new file mode 100644 index 0000000..20bb8ea --- /dev/null +++ b/pbxt/fix-low-priority.patch @@ -0,0 +1,54 @@ +--- pbxt/src/pthread_xt.old.cc 2010-04-29 06:14:56.000000000 -0400 ++++ pbxt/src/pthread_xt.cc 2013-01-20 00:12:58.000000000 -0500 +@@ -547,42 +547,23 @@ + + xtPublic int xt_p_set_low_priority(pthread_t thr) + { +- if (pth_min_priority == pth_max_priority) { +- /* Under Linux the priority of normal (non-runtime) +- * threads are set using the standard methods +- * for setting process priority. +- */ +- +- /* We could set who == 0 because it should have the same affect +- * as using the PID. +- */ +- +- /* -20 = highest, 20 = lowest */ +- if (setpriority(PRIO_PROCESS, getpid(), 20) == -1) +- return errno; +- return 0; +- } +- return pth_set_priority(thr, pth_min_priority); ++ if (pth_min_priority != pth_max_priority) ++ return pth_set_priority(thr, pth_min_priority); ++ return 0; + } + + xtPublic int xt_p_set_normal_priority(pthread_t thr) + { +- if (pth_min_priority == pth_max_priority) { +- if (setpriority(PRIO_PROCESS, getpid(), 0) == -1) +- return errno; +- return 0; +- } +- return pth_set_priority(thr, pth_normal_priority); ++ if (pth_min_priority != pth_max_priority) ++ return pth_set_priority(thr, pth_normal_priority); ++ return 0; + } + + xtPublic int xt_p_set_high_priority(pthread_t thr) + { +- if (pth_min_priority == pth_max_priority) { +- if (setpriority(PRIO_PROCESS, getpid(), -20) == -1) +- return errno; +- return 0; +- } +- return pth_set_priority(thr, pth_max_priority); ++ if (pth_min_priority != pth_max_priority) ++ return pth_set_priority(thr, pth_max_priority); ++ return 0; + } + + #ifdef DEBUG_LOCKING |