## task_threads

Function - Return the target task's list of threads.

### SYNOPSIS

    kern_return_t   task_threads
                    (task_t                                    task,
                     thread_act_port_array_t            thread_list,
                     mach_msg_type_number_t*           thread_count);

### PARAMETERS

task
  [in task send right] The port for the task for which the thread list is to be returned.

thread_list
  [out pointer to dynamic array of thread send rights] The returned list of threads within task, in no particular order.

thread_count
  [out scalar] The returned count of threads in thread_list.

### DESCRIPTION

The task_threads function returns a list of the threads within task. The calling task or thread also receives a send right to the kernel port for each listed thread.

### RETURN VALUES

Only generic errors apply.

### RELATED INFORMATION

Functions: thread_create, thread_terminate, thread_suspend.