summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-04-01 22:40:29 +0000
committerjeff <jeff@FreeBSD.org>2003-04-01 22:40:29 +0000
commit886873a91d65f6b2ba6dd2c7bea20bf42088c8f5 (patch)
tree3110651e73bd0f4767e66643713757ce05ee6a57 /lib/libthr
parentad6f11b9355cd471bf68c99d735b372a08dcfa0e (diff)
downloadFreeBSD-src-886873a91d65f6b2ba6dd2c7bea20bf42088c8f5.zip
FreeBSD-src-886873a91d65f6b2ba6dd2c7bea20bf42088c8f5.tar.gz
- Reenable setschedparam and the prioceiling code now that the mutex code
has been restored.
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_mutex_prioceiling.c13
-rw-r--r--lib/libthr/thread/thr_setschedparam.c16
2 files changed, 10 insertions, 19 deletions
diff --git a/lib/libthr/thread/thr_mutex_prioceiling.c b/lib/libthr/thread/thr_mutex_prioceiling.c
index 4d50038..7701378 100644
--- a/lib/libthr/thread/thr_mutex_prioceiling.c
+++ b/lib/libthr/thread/thr_mutex_prioceiling.c
@@ -60,8 +60,6 @@ _pthread_mutexattr_getprioceiling(pthread_mutexattr_t *mattr, int *prioceiling)
int
_pthread_mutexattr_setprioceiling(pthread_mutexattr_t *mattr, int prioceiling)
{
- return (EINVAL);
-#if 0
int ret = 0;
if ((mattr == NULL) || (*mattr == NULL))
@@ -72,34 +70,28 @@ _pthread_mutexattr_setprioceiling(pthread_mutexattr_t *mattr, int prioceiling)
(*mattr)->m_ceiling = prioceiling;
return (ret);
-#endif
}
int
_pthread_mutex_getprioceiling(pthread_mutex_t *mutex,
int *prioceiling)
{
- return (EINVAL);
-#if 0
int ret;
if ((mutex == NULL) || (*mutex == NULL))
ret = EINVAL;
- else if ((*mutex)->m_attr.m_protocol != PTHREAD_PRIO_PROTECT)
+ else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
ret = EINVAL;
else
- ret = (*mutex)->m_attr.m_prio;
+ ret = (*mutex)->m_prio;
return (ret);
-#endif
}
int
_pthread_mutex_setprioceiling(pthread_mutex_t *mutex,
int prioceiling, int *old_ceiling)
{
- return (EINVAL);
-#if 0
int ret = 0;
if ((mutex == NULL) || (*mutex == NULL))
@@ -118,5 +110,4 @@ _pthread_mutex_setprioceiling(pthread_mutex_t *mutex,
}
}
return(ret);
-#endif
}
diff --git a/lib/libthr/thread/thr_setschedparam.c b/lib/libthr/thread/thr_setschedparam.c
index f9551e0..14aa207 100644
--- a/lib/libthr/thread/thr_setschedparam.c
+++ b/lib/libthr/thread/thr_setschedparam.c
@@ -42,9 +42,8 @@ int
_pthread_setschedparam(pthread_t pthread, int policy,
const struct sched_param *param)
{
-#if 0 /* XXXTHR */
+ pthread_t curthread;
int old_prio, in_readyq = 0, ret = 0;
-#endif
if ((param == NULL) || (policy < SCHED_FIFO) || (policy > SCHED_RR))
return (EINVAL);
@@ -53,11 +52,10 @@ _pthread_setschedparam(pthread_t pthread, int policy,
(param->sched_priority > PTHREAD_MAX_PRIORITY))
return (ENOTSUP);
- return (0);
-#if 0 /* XXXTHR */
+ curthread = _get_curthread();
/* Find the thread in the list of active threads: */
if ((ret = _find_thread(pthread)) == 0) {
- GIANT_LOCK();
+ GIANT_LOCK(curthread);
if (param->sched_priority !=
PTHREAD_BASE_PRIORITY(pthread->base_priority)) {
@@ -67,10 +65,12 @@ _pthread_setschedparam(pthread_t pthread, int policy,
* active priority:
*/
old_prio = pthread->active_priority;
+#if 0 /* XXXTHR */
if ((pthread->flags & PTHREAD_FLAGS_IN_PRIOQ) != 0) {
in_readyq = 1;
PTHREAD_PRIOQ_REMOVE(pthread);
}
+#endif
/* Set the thread base priority: */
pthread->base_priority &=
@@ -80,7 +80,7 @@ _pthread_setschedparam(pthread_t pthread, int policy,
/* Recalculate the active priority: */
pthread->active_priority = MAX(pthread->base_priority,
pthread->inherited_priority);
-
+#if 0
if (in_readyq) {
if ((pthread->priority_mutex_count > 0) &&
(old_prio > pthread->active_priority)) {
@@ -96,6 +96,7 @@ _pthread_setschedparam(pthread_t pthread, int policy,
else
PTHREAD_PRIOQ_INSERT_TAIL(pthread);
}
+#endif
/*
* Check for any mutex priority adjustments. This
@@ -108,8 +109,7 @@ _pthread_setschedparam(pthread_t pthread, int policy,
/* Set the scheduling policy: */
pthread->attr.sched_policy = policy;
- GIANT_UNLOCK();
+ GIANT_UNLOCK(curthread);
}
return(ret);
-#endif
}
OpenPOWER on IntegriCloud