thread.h Reference

Declared in
thread.h

Overview

Included Headers

  • <mach/kern_return.h>

  • <mach/mach_types.h>

  • <mach/message.h>

  • <mach/boolean.h>

  • <mach/vm_param.h>

  • <mach/thread_info.h>

  • <mach/thread_status.h>

  • <mach/exception_types.h>

  • <kern/kern_types.h>

  • <sys/cdefs.h>

Functions

See the Overview section above for header-level documentation.

kernel_thread_start

Create a kernel thread.

extern kern_return_t kernel_thread_start(
   thread_continue_t continuation,
   void *parameter,
   thread_t *new_thread);
Parameters
continuation

A C-function pointer where the thread will begin execution.

parameter

Caller specified data to be passed to the new thread.

new_thread

Reference to the new thread is returned in this parameter.

Return Value

Returns KERN_SUCCESS on success or an appropriate kernel code type.

Discussion

This function takes three input parameters, namely reference to the function that the thread should execute, caller specified data and a reference which is used to return the newly created kernel thread. The function returns KERN_SUCCESS on success or an appropriate kernel code type indicating the error. It may be noted that the caller is responsible for explicitly releasing the reference to the created thread when no longer needed. This should be done by calling thread_deallocate(new_thread).

Availability
  • Available in OS X v10.4 and later.
Declared In
thread.h