aboutsummaryrefslogtreecommitdiff
path: root/nptl/pthread_setschedparam.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-08-14 23:11:18 +0000
committerUlrich Drepper <drepper@redhat.com>2006-08-14 23:11:18 +0000
commitf17efcb43e500d4af62b71bd6f286af831069b5a (patch)
treebf062a11f158b5bc8e33e42cc85e625751bacf94 /nptl/pthread_setschedparam.c
parent107b8a922a9f72bae8d066549c675062bee0897f (diff)
downloadglibc-f17efcb43e500d4af62b71bd6f286af831069b5a.tar
glibc-f17efcb43e500d4af62b71bd6f286af831069b5a.tar.gz
glibc-f17efcb43e500d4af62b71bd6f286af831069b5a.tar.bz2
glibc-f17efcb43e500d4af62b71bd6f286af831069b5a.zip
* sysdeps/powerpc/powerpc32/dl-trampoline.S (_dl_runtime_resolve):
Don't clobber caller's LRSAVE. (_dl_prof_resolve): Likewise.
Diffstat (limited to 'nptl/pthread_setschedparam.c')
-rw-r--r--nptl/pthread_setschedparam.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/nptl/pthread_setschedparam.c b/nptl/pthread_setschedparam.c
index 5889cc98a9..30ac6b3e89 100644
--- a/nptl/pthread_setschedparam.c
+++ b/nptl/pthread_setschedparam.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -45,6 +45,19 @@ __pthread_setschedparam (threadid, policy, param)
lll_lock (pd->lock);
+ struct sched_param p;
+ const struct sched_param *orig_param = param;
+
+ /* If the thread should have higher priority because of some
+ PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
+ if (__builtin_expect (pd->tpp != NULL, 0)
+ && pd->tpp->priomax > param->sched_priority)
+ {
+ p = *param;
+ p.sched_priority = pd->tpp->priomax;
+ param = &p;
+ }
+
/* Try to set the scheduler information. */
if (__builtin_expect (__sched_setscheduler (pd->tid, policy,
param) == -1, 0))
@@ -54,7 +67,7 @@ __pthread_setschedparam (threadid, policy, param)
/* We succeeded changing the kernel information. Reflect this
change in the thread descriptor. */
pd->schedpolicy = policy;
- memcpy (&pd->schedparam, param, sizeof (struct sched_param));
+ memcpy (&pd->schedparam, orig_param, sizeof (struct sched_param));
pd->flags |= ATTR_FLAG_SCHED_SET | ATTR_FLAG_POLICY_SET;
}