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