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