thread_createcreates 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_createis called to get the new thread's identifier, (child_thread). Then
thread_set_stateis called to set a processor state, and finally
thread_resumeis 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
The function returns
KERN_SUCCESSif a new thread has been created,
KERN_INVALID_ARGUMENTif parent_task is not a valid task and
KERN_RESOURCE_SHORTAGEif some critical kernel resource is not available.