1<h2>thread_set_policy</h2>
2<hr>
3<p>
4<strong>Function</strong> - Set target thread's scheduling policy state. (Protected Interface.)
5<h3>SYNOPSIS</h3>
6<pre>
7<strong>kern_return_t   thread_set_policy</strong>
8                <strong>(thread_act_t</strong>                            <var>thread</var>,
9                 <strong>processor_set_t</strong>                  <var>processor_set</var>,
10                 <strong>policy_t</strong>                                <var>policy</var>,
11                 <strong>policy_base_t</strong>                             <var>base</var>,
12                 <strong>mach_msg_type_number_t</strong>              <var>base_count</var>,
13                 <strong>policy_limit_t</strong>                           <var>limit</var>,
14                 <strong>mach_msg_type_number_</strong>              <var>limit_count</var><strong>);</strong>
15</pre>
16<h3>PARAMETERS</h3>
17<dl>
18<p>
19<dt> <var>thread</var> 
20<dd>
21[in thread send right]
22The thread scheduling policy is to be set.
23<p>
24<dt> <var>processor_set</var> 
25<dd>
26[in processor-set-control send right]
27The control port for the processor 
28set to which the thread is currently assigned.
29<p>
30<dt> <var>policy</var> 
31<dd>
32[in scalar]
33Policy to be set.  The values currently defined are <strong>POLICY_TIMESHARE</strong>, 
34<strong>POLICY_RR</strong> (round robin) and <strong>POLICY_FIFO</strong> (firstin, first-out).
35<p>
36<dt> <var>base</var> 
37<dd>
38[pointer to in structure]
39Base policy specific data, <strong>policy_fifo_base</strong>, 
40<strong>policy_rr_base</strong> or <strong>policy_timeshare_base</strong>.
41<p>
42<dt> <var>base_count</var> 
43<dd>
44[in scalar]
45The size of the buffer (in natural-sized units).
46<p>
47<dt> <var>limit</var> 
48<dd>
49[pointer to in structure]
50Policy specific limits, <strong>policy_fifo_limit</strong>,
51<strong>policy_rr_limit</strong> or <strong>policy_timeshare_limit</strong>.
52<p>
53<dt> <var>limit_count</var> 
54<dd>
55[in scalar]
56The size of the buffer (in natural-sized units).
57</dl>
58<h3>DESCRIPTION</h3>
59<p>
60The <strong>thread_set_policy</strong> function sets the scheduling
61attributes, both base and limit, for <var>thread</var>. 
62<var>policy</var> may be any policy implemented by the processor set 
63whether or not it is enabled.
64<h3>RETURN VALUES</h3>
65<dl>
66<p>
67<dt> <strong>KERN_INVALID_PROCESSOR_SET</strong>
68<dd>
69<var>processor_set</var> is not the thread's processor set control port.
70</dl>
71<h3>RELATED INFORMATION</h3>
72<p>
73Functions:
74<a href="P_set_policy_control.html"><strong>processor_set_policy_control</strong></a>,
75<a href="thread_policy.html"><strong>thread_policy</strong></a>,
76<a href="task_policy.html"><strong>task_policy</strong></a>,
77<a href="task_set_policy.html"><strong>task_set_policy</strong></a>.
78<p>
79Data Structures:
80<a href="policy_fifo_info.html"><strong>policy_fifo_info</strong></a>,
81<a href="policy_rr_info.html"><strong>policy_rr_info</strong></a>,
82<a href="policy_timeshare_info.html"><strong>policy_timeshare_info</strong></a>.
83