/*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
invalid_policy(policy) )
return(KERN_INVALID_ARGUMENT);
+ if (thread->static_param)
+ return (KERN_SUCCESS);
+
s = splsched();
thread_lock(thread);
if (policy == POLICY_TIMESHARE && !oldmode) {
thread->sched_mode |= TH_MODE_TIMESHARE;
- if (thread->state & TH_RUN)
- pset_share_incr(thread->processor_set);
+ if ((thread->state & (TH_RUN|TH_IDLE)) == TH_RUN)
+ sched_share_incr();
}
else
if (policy != POLICY_TIMESHARE && oldmode) {
thread->sched_mode &= ~TH_MODE_TIMESHARE;
- if (thread->state & TH_RUN)
- pset_share_decr(thread->processor_set);
+ if ((thread->state & (TH_RUN|TH_IDLE)) == TH_RUN)
+ sched_share_decr();
}
}
else {
kern_return_t result = KERN_SUCCESS;
if ( thread == THREAD_NULL ||
- pset == PROCESSOR_SET_NULL )
+ pset == PROCESSOR_SET_NULL || pset != &pset0)
return (KERN_INVALID_ARGUMENT);
thread_mtx_lock(thread);
- if (pset != thread->processor_set) {
- thread_mtx_unlock(thread);
-
- return (KERN_FAILURE);
- }
-
switch (policy) {
case POLICY_RR:
boolean_t set_limit)
{
kern_return_t result = KERN_SUCCESS;
- processor_set_t pset;
- policy_limit_t limit;
- int limcount;
+ processor_set_t pset = &pset0;
+ policy_limit_t limit = NULL;
+ int limcount = 0;
policy_rr_limit_data_t rr_limit;
policy_fifo_limit_data_t fifo_limit;
policy_timeshare_limit_data_t ts_limit;
thread_mtx_lock(thread);
- pset = thread->processor_set;
- if (pset == PROCESSOR_SET_NULL) {
- thread_mtx_unlock(thread);
-
- return (KERN_INVALID_ARGUMENT);
- }
-
if ( invalid_policy(policy) ||
((POLICY_TIMESHARE | POLICY_RR | POLICY_FIFO) & policy) == 0 ) {
thread_mtx_unlock(thread);