1*19c3b8c2SApple OSS Distributions<h2>thread_create</h2> 2*19c3b8c2SApple OSS Distributions<hr> 3*19c3b8c2SApple OSS Distributions<p> 4*19c3b8c2SApple OSS Distributions<strong>Function</strong> - Create a thread within a task. 5*19c3b8c2SApple OSS Distributions<h3>SYNOPSIS</h3> 6*19c3b8c2SApple OSS Distributions<pre> 7*19c3b8c2SApple OSS Distributions<strong>kern_return_t thread_create</strong> 8*19c3b8c2SApple OSS Distributions <strong>(task_t</strong> <var>parent_task</var>, 9*19c3b8c2SApple OSS Distributions <strong>thread_act_t</strong> <var>child_thread</var><strong>);</strong> 10*19c3b8c2SApple OSS Distributions</pre> 11*19c3b8c2SApple OSS Distributions<h3>PARAMETERS</h3> 12*19c3b8c2SApple OSS Distributions<dl> 13*19c3b8c2SApple OSS Distributions<p> 14*19c3b8c2SApple OSS Distributions<dt> <var>parent_task</var> 15*19c3b8c2SApple OSS Distributions<dd> 16*19c3b8c2SApple OSS Distributions[in task send right] 17*19c3b8c2SApple OSS DistributionsThe port for the task that is to contain the new 18*19c3b8c2SApple OSS Distributionsthread. 19*19c3b8c2SApple OSS Distributions<p> 20*19c3b8c2SApple OSS Distributions<dt> <var>child_thread</var> 21*19c3b8c2SApple OSS Distributions<dd> 22*19c3b8c2SApple OSS Distributions[out thread send right] 23*19c3b8c2SApple OSS DistributionsThe kernel-assigned name for the new thread. 24*19c3b8c2SApple OSS Distributions</dl> 25*19c3b8c2SApple OSS Distributions<h3>DESCRIPTION</h3> 26*19c3b8c2SApple OSS Distributions<p> 27*19c3b8c2SApple OSS DistributionsThe <strong>thread_create</strong> function creates a new thread within 28*19c3b8c2SApple OSS Distributions<var>parent_task</var>. The new thread has a suspend count of one and 29*19c3b8c2SApple OSS Distributionsno processor state. 30*19c3b8c2SApple OSS Distributions<p> 31*19c3b8c2SApple OSS DistributionsThe new thread holds a send right for its thread kernel port. 32*19c3b8c2SApple OSS DistributionsA send right for the 33*19c3b8c2SApple OSS Distributionsthread's kernel port is also returned to the calling task or 34*19c3b8c2SApple OSS Distributionsthread in <var>child_thread</var>. 35*19c3b8c2SApple OSS DistributionsThe new thread's exception ports are set to <strong>MACH_PORT_NULL</strong>. 36*19c3b8c2SApple OSS Distributions<h3>NOTES</h3> 37*19c3b8c2SApple OSS Distributions<p> 38*19c3b8c2SApple OSS DistributionsTo get a new thread running, first use <strong>thread_set_state</strong> 39*19c3b8c2SApple OSS Distributionsto set a processor state 40*19c3b8c2SApple OSS Distributionsfor the thread. Then, use <strong>thread_resume</strong> to schedule 41*19c3b8c2SApple OSS Distributionsthe thread for execution. 42*19c3b8c2SApple OSS DistributionsAlternately, use <strong>thread_create_running</strong>. 43*19c3b8c2SApple OSS Distributions<h3>RETURN VALUES</h3> 44*19c3b8c2SApple OSS Distributions<p> 45*19c3b8c2SApple OSS DistributionsOnly generic errors apply. 46*19c3b8c2SApple OSS Distributions<h3>RELATED INFORMATION</h3> 47*19c3b8c2SApple OSS Distributions<p> 48*19c3b8c2SApple OSS DistributionsFunctions: 49*19c3b8c2SApple OSS Distributions<a href="task_create.html"><strong>task_create</strong></a>, 50*19c3b8c2SApple OSS Distributions<a href="task_threads.html"><strong>task_threads</strong></a>, 51*19c3b8c2SApple OSS Distributions<a href="thread_get_special_port.html"><strong>thread_get_special_port</strong></a>, 52*19c3b8c2SApple OSS Distributions<a href="thread_get_state.html"><strong>thread_get_state</strong></a>, 53*19c3b8c2SApple OSS Distributions<a href="thread_resume.html"><strong>thread_resume</strong></a>, 54*19c3b8c2SApple OSS Distributions<a href="thread_set_special_port.html"><strong>thread_set_special_port</strong></a>, 55*19c3b8c2SApple OSS Distributions<a href="thread_set_state.html"><strong>thread_set_state</strong></a>, 56*19c3b8c2SApple OSS Distributions<a href="thread_suspend.html"><strong>thread_suspend</strong></a>, 57*19c3b8c2SApple OSS Distributions<a href="thread_terminate.html"><strong>thread_terminate</strong></a>, 58*19c3b8c2SApple OSS Distributions<a href="thread_create_running.html"><strong>thread_create_running</strong></a>. 59