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