## task_policy

Function - Set target task's default scheduling policy state.

### SYNOPSIS

    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);

### PARAMETERS

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.

### DESCRIPTION

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.

### RETURN VALUES

KERN_INVALID_POLICY
  The processor set does not currently enable policy.
KERN_POLICY_LIMIT
  The specified scheduling attributes exceeds the thread's limits.

### RELATED INFORMATION

Functions: thread_policy, thread_set_policy, task_set_policy, processor_set_policy_control.

Data Structures: policy_fifo_info, policy_rr_info, policy_timeshare_info.