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