1<h2>thread_policy</h2>
2<hr>
3<p>
4<strong>Function</strong> - Set target thread's scheduling policy state.
5<h3>SYNOPSIS</h3>
6<pre>
7<strong>kern_return_t   thread_policy</strong>
8                <strong>(thread_act_t</strong>                            <var>thread</var>,
9                 <strong>policy_t</strong>                                <var>policy</var>,
10                 <strong>policy_base_t</strong>                             <var>base</var>,
11                 <strong>base</strong>                                <var>base_count</var>,
12                 <strong>boolean_t</strong>                            <var>set_limit</var><strong>);</strong>
13</pre>
14<h3>PARAMETERS</h3>
15<dl>
16<p>
17<dt> <var>thread</var> 
18<dd>
19[in thread send right]
20The thread scheduling policy is to be set.
21<p>
22<dt> <var>policy</var> 
23<dd>
24[in scalar]
25Policy to be set.  The values currently defined are <strong>POLICY_TIMESHARE</strong>, 
26<strong>POLICY_RR</strong> (round robin) and <strong>POLICY_FIFO</strong> (firstin, first-out).
27<p>
28<dt> <var>base</var> 
29<dd>
30[pointer to in structure]
31Base scheduling policy specific data,
32<strong>policy_fifo_base</strong>, <strong>policy_rr_base</strong> or <strong>policy_timeshare_base</strong>.
33<p>
34<dt> <var>base_count</var> 
35<dd>
36[in scalar]
37The size of the buffer (in natural-sized units).
38<p>
39<dt> <var>set_limit</var> 
40<dd>
41[in scalar]
42True if the thread's scheduling limits should be restricted to 
43allow no more service than specified by <var>base</var>.
44</dl>
45<h3>DESCRIPTION</h3>
46<p>
47The <strong>thread_policy</strong> function sets the scheduling policy
48to be applied to thread.  <var>policy</var> must be a scheduling policy 
49currently "enabled" for the thread's assigned processor set.
50<h3>RETURN VALUES</h3>
51<dl>
52<p>
53<dt> <strong>KERN_INVALID_POLICY</strong>
54<dd>
55The processor set to which <var>thread</var> is currently assigned does
56not currently enable <var>policy</var>.
57<p>
58<dt> <strong>KERN_POLICY_LIMIT</strong>
59<dd>
60The specified scheduling attributes exceeds the thread's limits.
61</dl>
62<h3>RELATED INFORMATION</h3>
63<p>
64Functions:
65<a href="P_set_policy_control.html"><strong>processor_set_policy_control</strong></a>,
66<a href="thread_set_policy.html"><strong>thread_set_policy</strong></a>,
67<a href="task_policy.html"><strong>task_policy</strong></a>,
68<a href="task_set_policy.html"><strong>task_set_policy</strong></a>.
69<p>
70Data Structures:
71<a href="policy_fifo_info.html"><strong>policy_fifo_info</strong></a>,
72<a href="policy_rr_info.html"><strong>policy_rr_info</strong></a>,
73<a href="policy_timeshare_info.html"><strong>policy_timeshare_info</strong></a>.
74