NAME
thread_create - creates new thread within named task
SYNOPSIS
#include <mach.h>
kern_return_t
thread_create(parent_task, child_thread)
task_t parent_task;
thread_t *child_thread; /* out */
DESCRIPTION
thread_create creates a new thread within the task specified
by
parent_task. The new thread has no processor state, and has
a
suspend count of 1. To get a new thread to run, first
thread_create is called to get the new thread’s
identifier,
(child_thread). Then thread_set_state is called to set a
processor
state, and finally thread_resume is called to get the thread
scheduled to execute.
When the thread is created send
rights to its thread kernel port
are given to it and returned to the caller in child_thread.
The new
thread’s exception port is set to PORT_NULL.
ARGUMENTS
parent_task The task which is to contain the new thread.
child_thread The new thread.
DIAGNOSTICS
KERN_SUCCESS A new thread has been created.
KERN_INVALID_ARGUMENT parent_task is not a valid task.
KERN_RESOURCE_SHORTAGE Some
critical kernel resource is not
available.
SEE ALSO
task_create(2), task_threads(2), thread_terminate(2),
thread_suspend(2), thread_resume(2),
thread_special_ports(2),
thread_set_state(2)