osfmk/man/task_policy.html
Function - Set target task's default scheduling policy state.
**kern\_return\_t task\_policy**** (task\_t **task,** policy\_t **policy,** policy\_base\_t **base,** base **base\_count,** boolean\_t **set\_limit,** boolean\_t **change\_threads** );**
task[in task send right] The port for the task whose scheduling attributes are to be set. policy[in scalar] Default policy. The values currently defined are POLICY_TIMESHARE , POLICY_RR (round robin) and POLICY_FIFO (firstin, first-out). base[pointer to in structure] Base scheduling policy data, policy_fifo_base , policy_rr_base or policy_timeshare_base. base_count[in scalar] The size of the buffer (in natural-sized units). set_limit[in scalar] True if the scheduling limits for the task should be restricted to allow no more service than specified by base. change_threads[in scalar] True if the attributes (and limits, if set_limit is true) of existing threads within the task should also be changed.
The task_policy function sets the default scheduling attributes for task. These attributes are used when creating new threads. Changing the default attributes for a task does not affect the attributes of the contained threads unless change_threads is TRUE. At no time will a thread ever have scheduling attributes that exceed the thread's limits.
KERN_INVALID_POLICY The processor set does not currently enable policy. KERN_POLICY_LIMIT The specified scheduling attributes exceeds the thread's limits.
Functions: thread_policy, thread_set_policy, task_set_policy, processor_set_policy_control.
Data Structures: policy_fifo_info, policy_rr_info, policy_timeshare_info.