Lines Matching refs:thread

45 #include <kern/thread.h>
57 #include <kern/thread.h>
65 * Set scheduling policy & priority for thread.
69 thread_t thread,
75 if ( thread == THREAD_NULL ||
79 if (thread->static_param)
87 thread_lock(thread);
89 if ( (thread->sched_mode != TH_MODE_REALTIME) &&
90 (thread->saved_mode != TH_MODE_REALTIME) ) {
91 if (!(thread->sched_flags & TH_SFLAG_DEMOTED_MASK)) {
92 boolean_t oldmode = thread->sched_mode == TH_MODE_TIMESHARE;
95 thread->sched_mode = TH_MODE_TIMESHARE;
97 if ((thread->state & (TH_RUN|TH_IDLE)) == TH_RUN)
102 thread->sched_mode = TH_MODE_FIXED;
104 if ((thread->state & (TH_RUN|TH_IDLE)) == TH_RUN)
110 thread->saved_mode = TH_MODE_TIMESHARE;
112 thread->saved_mode = TH_MODE_FIXED;
115 if (priority >= thread->max_priority)
116 priority = thread->max_priority - thread->task_priority;
126 priority += thread->task_priority;
128 if (priority > thread->max_priority)
129 priority = thread->max_priority;
135 if ((thread->task->ext_appliedstate.apptype == PROC_POLICY_IOS_APPLE_DAEMON) &&
136 (thread->appliedstate.hw_bg == TASK_POLICY_BACKGROUND_ATTRIBUTE_ALL)) {
137 thread->saved_importance = priority - thread->task_priority;
140 thread->importance = priority - thread->task_priority;
146 thread->importance = priority - thread->task_priority;
150 set_priority(thread, priority);
153 thread_unlock(thread);
163 * the given thread. Policy can be any policy implemented by the
168 thread_t thread,
179 if ( thread == THREAD_NULL ||
183 thread_mtx_lock(thread);
256 thread_mtx_unlock(thread);
261 result = thread_policy_common(thread, policy, bas);
263 thread_mtx_unlock(thread);
273 * the given thread. Policy must be a policy which is enabled for the
278 thread_t thread,
292 if (thread == THREAD_NULL)
295 thread_mtx_lock(thread);
299 thread_mtx_unlock(thread);
385 if (rr_base->base_priority > thread->max_priority) {
390 rr_limit.max_priority = thread->max_priority;
407 if (fifo_base->base_priority > thread->max_priority) {
412 fifo_limit.max_priority = thread->max_priority;
429 if (ts_base->base_priority > thread->max_priority) {
434 ts_limit.max_priority = thread->max_priority;
447 thread_mtx_unlock(thread);
450 result = thread_set_policy(thread, pset,