## thread_set_state

Function - Set the target thread's user-mode execution state.

### SYNOPSIS

    kern_return_t   thread_set_state
                    (thread_act_t                     target_thread,
                     thread_state_flavor_t                   flavor,
                     thread_state_t                       new_state,
                     target_thread                  new_state_count);

### PARAMETERS

target_thread
  [in thread send right] The thread for which to set the execution state. The calling thread cannot specify itself.

flavor
  [in scalar] The type of state to set. Valid values correspond to supported machine architecture features.

new_state
  [pointer to in structure] State information for the specified thread.

new_state_count
  [in scalar] The size of the buffer (in natural-sized units).

### DESCRIPTION

The thread_set_state function sets the execution state (for example, the machine registers) for target_thread. flavor specifies the type of state to set.

The format of the state to set is machine specific; it is defined in mach/thread_status.h.

### RETURN VALUES

Only generic errors apply.

### RELATED INFORMATION

Functions: task_info, thread_get_state, thread_info.