summaryrefslogtreecommitdiff
path: root/storage/pbxt
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-06-13 16:57:11 +0300
committerMichael Widenius <monty@askmonty.org>2011-06-13 16:57:11 +0300
commit53270955bb38eebc1a4f0b19810817a0543b8f33 (patch)
tree50541ad335a3f15831ce4e017973f5a33a0fea94 /storage/pbxt
parentbf0e1f44c6b3306e84bbfd783c898a1764836242 (diff)
downloadmariadb-git-53270955bb38eebc1a4f0b19810817a0543b8f33.tar.gz
Change in PBXT to only use pth_set_priority() (not setpriority()) to set priority
Diffstat (limited to 'storage/pbxt')
-rwxr-xr-xstorage/pbxt/src/pthread_xt.cc39
1 files changed, 9 insertions, 30 deletions
diff --git a/storage/pbxt/src/pthread_xt.cc b/storage/pbxt/src/pthread_xt.cc
index c5dc2e41fdd..64c03db734c 100755
--- a/storage/pbxt/src/pthread_xt.cc
+++ b/storage/pbxt/src/pthread_xt.cc
@@ -547,44 +547,23 @@ xtPublic void xt_p_init_threading(void)
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 */
-#ifdef SET_GLOBAL_PRIORITY
- if (setpriority(PRIO_PROCESS, getpid(), 20) == -1)
- return errno;
-#endif
- 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