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