osfmk/man/thread_set_policy.html
Function - Set target thread's scheduling policy state. (Protected Interface.)
**kern\_return\_t thread\_set\_policy**** (thread\_act\_t **thread,** processor\_set\_t **processor\_set,** policy\_t **policy,** policy\_base\_t **base,** mach\_msg\_type\_number\_t **base\_count,** policy\_limit\_t **limit,** mach\_msg\_type\_number\_ **limit\_count** );**
thread[in thread send right] The thread scheduling policy is to be set.
processor_set[in processor-set-control send right] The control port for the processor set to which the thread is currently assigned.
policy[in scalar] Policy to be set. The values currently defined are POLICY_TIMESHARE , POLICY_RR (round robin) and POLICY_FIFO (firstin, first-out).
base[pointer to in structure] Base policy specific data, policy_fifo_base , policy_rr_base or policy_timeshare_base.
base_count[in scalar] The size of the buffer (in natural-sized units).
limit[pointer to in structure] Policy specific limits, policy_fifo_limit , policy_rr_limit or policy_timeshare_limit.
limit_count[in scalar] The size of the buffer (in natural-sized units).
The thread_set_policy function sets the scheduling attributes, both base and limit, for thread. policy may be any policy implemented by the processor set whether or not it is enabled.
KERN_INVALID_PROCESSOR_SET processor_set is not the thread's processor set control port.
Functions: processor_set_policy_control, thread_policy, task_policy, task_set_policy.
Data Structures: policy_fifo_info, policy_rr_info, policy_timeshare_info.