## thread_set_special_port

Function - Set caller-specified special port belonging to the target thread.

### SYNOPSIS

    kern_return_t   thread_set_special_port
                    (thread_act_t                            thread,
                     int                                 which_port,
                     mach_port_t                       special_port);

#### Macro form:

    kern_return_t   thread_set_kernel_port
                    (thread_act_t                            thread,
                     mach_port_t                       special_port);

### PARAMETERS

thread
  [in thread send right] The thread for which to set the port.

which_port
  [in scalar] The special port to be set. Valid values are:

  THREAD_KERNEL_PORT
    [thread-self port] The thread's kernel port. Used by the kernel to receive messages from the thread. This is the movable port for the thread and different from mach_thread_self(immovable).

special_port
  [in thread-special send right] The value for the port.

### DESCRIPTION

The thread_set_special_port function sets a special port belonging to thread.

### RETURN VALUES

Only generic errors apply.

### RELATED INFORMATION

Functions: mach_thread_self, task_get_special_port, task_set_special_port, thread_create, thread_get_special_port.