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