## thread_policy

Function - Set target thread's scheduling policy state.

### SYNOPSIS

    kern_return_t   thread_policy
                    (thread_act_t                            thread,
                     policy_t                                policy,
                     policy_base_t                             base,
                     base                                base_count,
                     boolean_t                            set_limit);

### PARAMETERS

thread
  [in thread send right] The thread scheduling policy is to be set.

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 scheduling 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).

set_limit
  [in scalar] True if the thread's scheduling limits should be restricted to allow no more service than specified by base.

### DESCRIPTION

The thread_policy function sets the scheduling policy to be applied to thread. policy must be a scheduling policy currently "enabled" for the thread's assigned processor set.

### RETURN VALUES

KERN_INVALID_POLICY
  The processor set to which thread is currently assigned does not currently enable policy.

KERN_POLICY_LIMIT
  The specified scheduling attributes exceeds the thread's limits.

### RELATED INFORMATION

Functions: processor_set_policy_control, thread_set_policy, task_policy, task_set_policy.

Data Structures: policy_fifo_info, policy_rr_info, policy_timeshare_info.