1<h2>thread_create_running</h2>
2<hr>
3<p>
4<strong>Function</strong> - Optimized creation of a running thread.
5<h3>SYNOPSIS</h3>
6<pre>
7<strong>kern_return_t   thread_create_running</strong>
8                <strong>(task_t</strong>                             <var>parent_task</var>,
9                 <strong>thread_state_flavor_t</strong>                   <var>flavor</var>,
10                 <strong>thread_state_t</strong>                           <var>state</var>,
11                 <strong>thread_act_t</strong>                      <var>child_thread</var><strong>);</strong>
12</pre>
13<h3>PARAMETERS</h3>
14<dl>
15<p>
16<dt> <var>parent_task</var> 
17<dd>
18[in task send right]
19The port for the task that is to contain the new 
20thread.
21<p>
22<dt> <var>flavor</var> 
23<dd>
24[in scalar]
25The type of state to establish.  Valid values correspond to 
26supported machine architecture features.
27<p>
28<dt> <var>state</var> 
29<dd>
30[pointer to in structure]
31State information for the specified thread.
32<p>
33<dt> <var>child_thread</var> 
34<dd>
35[out thread send right]
36The kernel-assigned name for the new thread.
37</dl>
38<h3>DESCRIPTION</h3>
39<p>
40The <strong>thread_create_running</strong> function creates a new thread
41within <var>parent_task</var>. 
42The new thread has is not suspended.  Its initial state is given
43by <var>state</var>.  <var>flavor</var> specifies the type of state to set.
44<p>
45The format of the state to set is machine specific; it is defined in 
46\*L<mach/thread_status.h>\*O.
47<p>
48The new thread holds a send right for its thread kernel port.
49A send right for the 
50thread's kernel port is also returned to the calling task or
51thread in <var>child_thread</var>. 
52The new thread's exception ports are set to <strong>MACH_PORT_NULL</strong>.
53<h3>NOTES</h3>
54<p>
55This is an optimized form of the sequence: <strong>thread_create</strong>,
56<strong>thread_set_state</strong> 
57and <strong>thread_resume</strong>.
58<h3>RETURN VALUES</h3>
59<p>
60Only generic errors apply.
61<h3>RELATED INFORMATION</h3>
62<p>
63Functions:
64<a href="task_create.html"><strong>task_create</strong></a>,
65<a href="task_threads.html"><strong>task_threads</strong></a>,
66<a href="thread_get_special_port.html"><strong>thread_get_special_port</strong></a>,
67<a href="thread_get_state.html"><strong>thread_get_state</strong></a>,
68<a href="thread_resume.html"><strong>thread_resume</strong></a>,
69<a href="thread_set_special_port.html"><strong>thread_set_special_port</strong></a>,
70<a href="thread_set_state.html"><strong>thread_set_state</strong></a>,
71<a href="thread_suspend.html"><strong>thread_suspend</strong></a>,
72<a href="thread_terminate.html"><strong>thread_terminate</strong></a>,
73<a href="thread_create.html"><strong>thread_create</strong></a>.
74