xref: /xnu-10063.121.3/osfmk/man/thread_suspend.html (revision 2c2f96dc2b9a4408a43d3150ae9c105355ca3daa)
1*2c2f96dcSApple OSS Distributions<h2>thread_suspend</h2>
2*2c2f96dcSApple OSS Distributions<hr>
3*2c2f96dcSApple OSS Distributions<p>
4*2c2f96dcSApple OSS Distributions<strong>Function</strong> - Suspend a thread.
5*2c2f96dcSApple OSS Distributions<h3>SYNOPSIS</h3>
6*2c2f96dcSApple OSS Distributions<pre>
7*2c2f96dcSApple OSS Distributions<strong>kern_return_t   thread_suspend</strong>
8*2c2f96dcSApple OSS Distributions                <strong>(thread_act_t</strong>                     <var>target_thread</var><strong>);</strong>
9*2c2f96dcSApple OSS Distributions</pre>
10*2c2f96dcSApple OSS Distributions<h3>PARAMETERS</h3>
11*2c2f96dcSApple OSS Distributions<dl>
12*2c2f96dcSApple OSS Distributions<p>
13*2c2f96dcSApple OSS Distributions<dt> <var>target_thread</var>
14*2c2f96dcSApple OSS Distributions<dd>
15*2c2f96dcSApple OSS Distributions[in thread send right]
16*2c2f96dcSApple OSS DistributionsThe thread to be suspended.
17*2c2f96dcSApple OSS Distributions</dl>
18*2c2f96dcSApple OSS Distributions<h3>DESCRIPTION</h3>
19*2c2f96dcSApple OSS Distributions<p>
20*2c2f96dcSApple OSS DistributionsThe <strong>thread_suspend</strong> function increments the suspend
21*2c2f96dcSApple OSS Distributionscount for <var>target_thread</var>
22*2c2f96dcSApple OSS Distributionsand prevents the thread from executing any more user-level instructions.
23*2c2f96dcSApple OSS Distributions<p>
24*2c2f96dcSApple OSS DistributionsIn this context, a user-level instruction can be either a machine instruction
25*2c2f96dcSApple OSS Distributionsexecuted in user mode or a system trap instruction, including
26*2c2f96dcSApple OSS Distributionsa page fault.  If a
27*2c2f96dcSApple OSS Distributionsthread is currently executing within a system trap, the kernel
28*2c2f96dcSApple OSS Distributionscode may continue
29*2c2f96dcSApple OSS Distributionsto execute until it reaches the system return code or it may
30*2c2f96dcSApple OSS Distributionssuspend within the
31*2c2f96dcSApple OSS Distributionskernel code.  In either case, the system trap returns when the thread resumes.
32*2c2f96dcSApple OSS Distributions<p>
33*2c2f96dcSApple OSS DistributionsTo resume a suspended thread, use <strong>thread_resume</strong>.  If
34*2c2f96dcSApple OSS Distributionsthe suspend count is
35*2c2f96dcSApple OSS Distributionsgreater than one, <strong>thread_resume</strong> must be repeated that
36*2c2f96dcSApple OSS Distributionsnumber of times.
37*2c2f96dcSApple OSS Distributions<h3>CAUTIONS</h3>
38*2c2f96dcSApple OSS Distributions<p>
39*2c2f96dcSApple OSS DistributionsUnpredictable results may occur if a program suspends a thread and alters its
40*2c2f96dcSApple OSS Distributionsuser state so that its direction is changed upon resuming.  Note that the
41*2c2f96dcSApple OSS Distributions<strong>thread_abort</strong> function allows a system call to be aborted
42*2c2f96dcSApple OSS Distributionsonly if it is progressing in a
43*2c2f96dcSApple OSS Distributionspredictable way.
44*2c2f96dcSApple OSS Distributions<h3>RETURN VALUES</h3>
45*2c2f96dcSApple OSS Distributions<p>
46*2c2f96dcSApple OSS DistributionsOnly generic errors apply.
47*2c2f96dcSApple OSS Distributions<h3>RELATED INFORMATION</h3>
48*2c2f96dcSApple OSS Distributions<p>
49*2c2f96dcSApple OSS DistributionsFunctions:
50*2c2f96dcSApple OSS Distributions<a href="task_resume.html"><strong>task_resume</strong></a>,
51*2c2f96dcSApple OSS Distributions<a href="task_suspend.html"><strong>task_suspend</strong></a>,
52*2c2f96dcSApple OSS Distributions<a href="thread_abort.html"><strong>thread_abort</strong></a>,
53*2c2f96dcSApple OSS Distributions<a href="thread_get_state.html"><strong>thread_get_state</strong></a>,
54*2c2f96dcSApple OSS Distributions<a href="thread_info.html"><strong>thread_info</strong></a>,
55*2c2f96dcSApple OSS Distributions<a href="thread_resume.html"><strong>thread_resume</strong></a>,
56*2c2f96dcSApple OSS Distributions<a href="thread_set_state.html"><strong>thread_set_state</strong></a>,
57*2c2f96dcSApple OSS Distributions<a href="thread_terminate.html"><strong>thread_terminate</strong></a>.
58