#include <mach/thread_act.h>

mach/thread_act.h Kernel.framework

Module thread_act
includes: Kernel/string.h, Kernel/mach/ndr.h, Kernel/mach/boolean.h, Kernel/mach/kern_return.h, Kernel/mach/notify.h, mach/mach_types.h, mach/message.h, Kernel/mach/mig_errors.h, mach/port.h, Availability.h, Kernel/mach/std_types.h, Kernel/mach/mig.h, Kernel/mach/mig.h, mach/mach_types.h, sys/cdefs.h
21 functions

functionthread_terminate

extern kern_return_t thread_terminate(thread_act_t target_act)
If building for Sandbox, keep NAME unchanged Destroy the target thread. JMM - For legacy reasons this consumes a reference to the target thread. This will have to change in the future because we want the interfaces to be able to be defined in more standard IDLs and transports, and most of them do not support the notion of reference ownership transfers (just sharing).
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Destroy a thread.
The thread_terminate function kills target_thread.
GNU Mach reference · 7.1.2 Thread Termination · © FSF, GFDL
kern_return_t thread_terminate(thread_t target_thread)
The function thread_terminate destroys the thread specified by target_thread. The function returns KERN_SUCCESS if the thread has been killed and KERN_INVALID_ARGUMENT if target_thread is not a thread.

functionact_get_state

extern kern_return_t act_get_state(
	thread_read_t target_act,
	int flavor,
	thread_state_t old_state, /* out */
	mach_msg_type_number_t *old_stateCnt
)
Return the selected state information for the target thr_act. If the thr_act is currently executing, the results may be stale. [Flavor THREAD_STATE_FLAVOR_LIST provides a list of valid flavors for the target thread.]
MIG routine from mach/thread_act.defs

functionact_set_state

extern kern_return_t act_set_state(
	thread_act_t target_act,
	int flavor,
	thread_state_t new_state,
	mach_msg_type_number_t new_stateCnt
)
Set the selected state information for the target thread. If the thread is currently executing, the state change may be ill-defined.
MIG routine from mach/thread_act.defs

functionthread_get_state

extern kern_return_t thread_get_state(
	thread_read_t target_act,
	thread_state_flavor_t flavor,
	thread_state_t old_state, /* out */
	mach_msg_type_number_t *old_stateCnt
)
Backward compatible old-style thread routines. These have different semantics than the new activation versions. Return the selected state information for the target thread. If the thread is currently executing, the results may be stale. [Flavor THREAD_STATE_FLAVOR_LIST provides a list of valid flavors for the target thr_act.]
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return the execution state for a thread.
The thread_get_state function returns the execution state (for example, the machine registers) for target_thread. flavor specifies the type of state information returned. The format of the data returned is machine specific; it is defined in \*L \*O.
GNU Mach reference · 7.1.5 Thread Execution · © FSF, GFDL
kern_return_t thread_get_state(thread_t target_thread, int flavor, thread_state_t old_state, mach_msg_type_number_t *old_stateCnt)
The function thread_get_state returns the execution state (e.g. the machine registers) of target_thread as specified by flavor. The old_state is an array of integers that is provided by the caller and returned filled with the specified information. old_stateCnt is input set to the maximum number of integers in old_state and returned equal to the actual number of integers in old_state. target_thread may not be mach_thread_self(). The definition of the state structures can be found in machine/thread_status.h. The function returns KERN_SUCCESS if the state has been returned, KERN_INVALID_ARGUMENT if target_thread is not a thread or is mach_thread_self or flavor is unrecognized for this machine. The function returns MIG_ARRAY_TOO_LARGE if the returned state is too large for old_state. In this case, old_state is filled as much as possible and old_stateCnt is set to the number of elements that would have been returned if there were enough room.

functionthread_set_state

extern kern_return_t thread_set_state(
	thread_act_t target_act,
	thread_state_flavor_t flavor,
	thread_state_t new_state,
	mach_msg_type_number_t new_stateCnt
)
Set the selected state information for the target thread. If the thread is currently executing, the state change may be ill-defined.
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Set the target thread's user-mode execution state.
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.
GNU Mach reference · 7.1.5 Thread Execution · © FSF, GFDL
kern_return_t thread_set_state(thread_t target_thread, int flavor, thread_state_t new_state, mach_msg_type_number_t new_state_count)
The function thread_set_state sets the execution state (e.g. the machine registers) of target_thread as specified by flavor. The new_state is an array of integers. new_state_count is the number of elements in new_state. The entire set of registers is reset. This will do unpredictable things if target_thread is not suspended. target_thread may not be mach_thread_self. The definition of the state structures can be found in machine/thread_status.h. The function returns KERN_SUCCESS if the state has been set and KERN_INVALID_ARGUMENT if target_thread is not a thread or is mach_thread_self or flavor is unrecognized for this machine.

functionthread_suspend

extern kern_return_t thread_suspend(thread_read_t target_act)
Increment the suspend count for the target thread. Once this call has completed, the thread will not execute any further user or meta- instructions. Once suspended, a thread may not execute again until its suspend count is zero, and the suspend count for its task is also zero.
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Suspend a thread.
The thread_suspend function increments the suspend count for target_thread and prevents the thread from executing any more user-level instructions. In this context, a user-level instruction can be either a machine instruction executed in user mode or a system trap instruction, including a page fault. If a thread is currently executing within a system trap, the kernel code may continue to execute until it reaches the system return code or it may suspend within the kernel code. In either case, the system trap returns when the thread resumes. To resume a suspended thread, use thread_resume. If the suspend count is greater than one, thread_resume must be repeated that number of times.
Cautions. Unpredictable results may occur if a program suspends a thread and alters its user state so that its direction is changed upon resuming. Note that the thread_abort function allows a system call to be aborted only if it is progressing in a predictable way.
GNU Mach reference · 7.1.5 Thread Execution · © FSF, GFDL
kern_return_t thread_suspend(thread_t target_thread)
Increments the thread's suspend count and prevents the thread from executing any more user level instructions. In this context a user level instruction is either a machine instruction executed in user mode or a system trap instruction including page faults. Thus if a thread is currently executing within a system trap the kernel code may continue to execute until it reaches the system return code or it may suspend within the kernel code. In either case, when the thread is resumed the system trap will return. This could cause unpredictable results if the user did a suspend and then altered the user state of the thread in order to change its direction upon a resume. The call thread_abort is provided to allow the user to abort any system call that is in progress in a predictable way. The suspend count may become greater than one with the effect that it will take more than one resume call to restart the thread. The function returns KERN_SUCCESS if the thread has been suspended and KERN_INVALID_ARGUMENT if target_thread is not a thread.

functionthread_resume

extern kern_return_t thread_resume(thread_read_t target_act)
Decrement the suspend count for the target thread, if that count is not already zero.
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Resume a thread.
The thread_resume function decrements the suspend count for target_thread by one. The thread is resumed if its suspend count goes to zero. If the suspend count is still positive, thread_resume must be repeated until the count reaches zero.
Notes. An attempt to lower the suspend count below zero is ignored.
GNU Mach reference · 7.1.5 Thread Execution · © FSF, GFDL
kern_return_t thread_resume(thread_t target_thread)
Decrements the thread's suspend count. If the count becomes zero the thread is resumed. If it is still positive, the thread is left suspended. The suspend count may not become negative. The function returns KERN_SUCCESS if the thread has been resumed, KERN_FAILURE if the suspend count is already zero and KERN_INVALID_ARGUMENT if target_thread is not a thread.

functionthread_abort

extern kern_return_t thread_abort(thread_act_t target_act)
Cause any user or meta- instructions currently being executed by the target thread to be aborted. [Meta- instructions consist of the basic traps for IPC (e.g., msg_send, msg_receive) and self-identification (e.g., task_self, thread_self, thread_reply). Calls described by MiG interfaces are not meta-instructions themselves.]
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Abort a thread.
The thread_abort function aborts page faults and any message primitive calls in use by target_thread. Scheduling depressions and clock sleeps are also aborted. The call returns a code indicating that it was interrupted. The call is interrupted even if the thread (or the task containing it) is suspended. If it is suspended, the thread receives the interrupt when it resumes. If its state is not modified before it resumes, the thread will retry an aborted page fault. The Mach message trap returns either MACH_SEND_INTERRUPTED or MACH_RCV_INTERRUPTED, depending on whether the send or the receive side was interrupted. Note, though, that the Mach message trap is contained within the mach_msg library routine, which, by default, retries interrupted message calls. The basic purpose of thread_abort is to let one thread cleanly stop another thread (target_thread). The target thread is stopped in such a manner that its future execution can be controlled in a predictable way. When thread_abort returns, the target thread will appear to have just returned from the kernel (if it had been in kernel mode).
Notes. By way of comparison, the thread_suspend function keeps the target thread from executing any further instructions at the user level, including the return from a system call. The thread_get_state function returns the thread's user state, while thread_set_state allows modification of the user state. A problem occurs if a suspended thread had been executing within a system call. In this case, the thread has, not only a user state, but an associated kernel state. (The kernel state cannot be changed with thread_set_state.) As a result, when the thread resumes, the system call can return, producing a change in the user state and, possibly, user memory. For a thread executing within a system call, thread_abort aborts the kernel call from the thread's point of view. Specifically, it resets the kernel state so that the thread will resume execution at the system call return, with the return code value set to one of the interrupted codes. The system call itself may be completed entirely, aborted entirely or be partially completed, depending on when the abort is received. As a result, if the thread's user state has been modified by thread_set_state, it will not be altered un-predictably by any unexpected system call side effects. For example, to simulate a POSIX signal, use the following sequence of calls: thread_suspend \(emTo stop the thread. thread_abort \(emTo interrupt any system call in progress and set the return value to "interrupted". Because the thread is already stopped, it will not return to user code. thread_set_state \(emTo modify the thread's user state to simulate a procedure call to the signal handler. thread_resume \(emTo resume execution at the signal handler. If the thread's stack is set up correctly, the thread can return to the interrupted system call. Note that the code to push an extra stack frame and change the registers is highly machine dependent.
Cautions. As a rule, do not use thread_abort on a non-suspended thread. This operation is very risky because it is difficult to know which system trap, if any, is executing and whether an interrupt return will result in some useful action by the thread. thread_abort will abort any non-atomic operation (such as a multi-page memory_object_data_supply) at an arbitrary point in a non-restartable way. Such problems can be avoided by using thread_abort_safely.
KERN_EXCEPTION_PROTECTEDThe thread is processing a protected exception.
GNU Mach reference · 7.1.5 Thread Execution · © FSF, GFDL
kern_return_t thread_abort(thread_t target_thread)
The function thread_abort aborts the kernel primitives: mach_msg, msg_send, msg_receive and msg_rpc and page-faults, making the call return a code indicating that it was interrupted. The call is interrupted whether or not the thread (or task containing it) is currently suspended. If it is suspended, the thread receives the interrupt when it is resumed. A thread will retry an aborted page-fault if its state is not modified before it is resumed. msg_send returns SEND_INTERRUPTED; msg_receive returns RCV_INTERRUPTED; msg_rpc returns either SEND_INTERRUPTED or RCV_INTERRUPTED, depending on which half of the RPC was interrupted. The main reason for this primitive is to allow one thread to cleanly stop another thread in a manner that will allow the future execution of the target thread to be controlled in a predictable way. thread_suspend keeps the target thread from executing any further instructions at the user level, including the return from a system call. thread_get_state/thread_set_state allows the examination or modification of the user state of a target thread. However, if a suspended thread was executing within a system call, it also has associated with it a kernel state. This kernel state can not be modified by thread_set_state with the result that when the thread is resumed the system call may return changing the user state and possibly user memory. thread_abort aborts the kernel call from the target thread's point of view by resetting the kernel state so that the thread will resume execution at the system call return with the return code value set to one of the interrupted codes. The system call itself will either be entirely completed or entirely aborted, depending on the precise moment at which the abort was received. Thus if the thread's user state has been changed by thread_set_state, it will not be modified by any unexpected system call side effects. For example to simulate a Unix signal, the following sequence of calls may be used: thread_suspend: Stops the thread. thread_abort: Interrupts any system call in progress, setting the return value to `interrupted'. Since the thread is stopped, it will not return to user code. thread_set_state: Alters thread's state to simulate a procedure call to the signal handler thread_resume: Resumes execution at the signal handler. If the thread's stack has been correctly set up, the thread may return to the interrupted system call. (Of course, the code to push an extra stack frame and change the registers is VERY machine-dependent.) Calling thread_abort on a non-suspended thread is pretty risky, since it is very difficult to know exactly what system trap, if any, the thread might be executing and whether an interrupt return would cause the thread to do something useful. The function returns KERN_SUCCESS if the thread received an interrupt and KERN_INVALID_ARGUMENT if target_thread is not a thread.

functionthread_abort_safely

extern kern_return_t thread_abort_safely(thread_act_t target_act)
Cause any user or meta- instructions currently being executed by the target thread to be aborted so that they are transparently restartable. This call fails if the abort would result in a non-restartable condition. Retry is the caller's responsibility. [Meta- instructions consist of the basic traps for IPC (e.g., msg_send, msg_receive) and self-identification (e.g., task_self, thread_self, thread_reply). Calls described by MiG interfaces are not meta-instructions themselves.]
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Abort a thread, restartably.
The thread_abort_safely function aborts page faults and any message primitive calls in use by target_thread. Scheduling depressions and clock sleeps are also aborted. The call returns a code indicating that it was interrupted. The call is interrupted even if the thread (or the task containing it) is suspended. If it is suspended, the thread receives the interrupt when it resumes. If its state is not modified before it resumes, the thread will retry an aborted page fault. The Mach message trap returns either MACH_SEND_INTERRUPTED or MACH_RCV_INTERRUPTED, depending on whether the send or the receive side was interrupted. Note, though, that the Mach message trap is contained within the mach_msg library routine, which, by default, retries interrupted message calls. The basic purpose of thread_abort_safely is to let one thread cleanly stop another thread (target_thread). The target thread is stopped in such a manner that its future execution can be controlled in a predictable way. When thread_abort_safely returns (if successful), the target thread will appear to have just returned from the kernel (if it had been in kernel mode).
Notes. By way of comparison, the thread_suspend function keeps the target thread from executing any further instructions at the user level, including the return from a system call. The thread_get_state function returns the thread's user state, while thread_set_state allows modification of the user state. A problem occurs if a suspended thread had been executing within a system call. In this case, the thread has, not only a user state, but an associated kernel state. (The kernel state cannot be changed with thread_set_state.) As a result, when the thread resumes, the system call can return, producing a change in the user state and, possibly, user memory. For a thread executing within a system call, thread_abort_safely aborts the kernel call from the thread's point of view. Specifically, it resets the kernel state so that the thread will resume execution at the system call return, with the return code value set to one of the interrupted codes. The system call itself may completed entirely, aborted entirely or be partially completed, depending on when the abort is received. As a result, if the thread's user state has been modified by thread_set_state, it will not be altered un-predictably by any unexpected system call side effects. For example, to simulate a POSIX signal, use the following sequence of calls: thread_suspend \(emTo stop the thread. thread_abort_safely \(emTo interrupt any system call in progress and set the return value to "interrupted". Because the thread is already stopped, it will not return to user code. thread_set_state \(emTo modify the thread's user state to simulate a procedure call to the signal handler. thread_resume \(emTo resume execution at the signal handler. If the thread's stack is set up correctly, the thread can return to the interrupted system call. Note that the code to push an extra stack frame and change the registers is highly machine dependent.
Cautions. As a rule, do not use thread_abort_safely on a non-suspended thread. This operation is very risky because it is difficult to know which system trap, if any, is executing and whether an interrupt return will result in some useful action by the thread. thread_abort_safely will not abort any non-atomic operation (such as a multi-page memory_object_data_supply or exception processing) but will return an error instead. The caller of this function must then allow the thread to resume and attempt to abort it later. If the thread must be aborted, even if doing so would abort any non-atomic operations, thread_abort would be used.
KERN_FAILUREThe thread is in the middle of a non-restartable operation.

functionthread_depress_abort

extern kern_return_t thread_depress_abort(thread_act_t thread)
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Cancel thread scheduling depression.
The thread_depress_abort function cancels any scheduling depression effective for thread caused by a thread_switch call.
GNU Mach reference · 7.1.6.2 Hand-Off Scheduling · © FSF, GFDL
kern_return_t thread_depress_abort(thread_t thread)
The function thread_depress_abort cancels any priority depression for thread caused by a swtch_pri or thread_switch call. The function returns KERN_SUCCESS if the call succeeded and KERN_INVALID_ARGUMENT if thread is not a valid thread.

functionthread_get_special_port

extern kern_return_t thread_get_special_port(
	thread_inspect_t thr_act,
	int which_port,
	mach_port_t *special_port /* out */
)
Returns the current value of the selected special port associated with the target thread.
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return a send right to the caller-specified special port.
The thread_get_special_port function returns a send right for a special port belonging to thread. The thread kernel port is a port for which the kernel holds the receive right. The kernel uses this port to identify the thread. If one thread has a send right for the kernel port of another thread, it can use the port to perform kernel operations for the other thread. Send rights for a kernel port normally are held only by the thread to which the port belongs, or by the task that contains the thread. Using the mach_msg function, however, any thread can pass a send right for its kernel port to another thread.
GNU Mach reference · 7.1.7 Thread Special Ports · © FSF, GFDL
kern_return_t thread_get_special_port(thread_t thread, int which_port, mach_port_t *special_port)
The function thread_get_special_port returns send rights to one of a set of special ports for the thread specified by thread. The possible values for which_port are THREAD_KERNEL_PORT and THREAD_EXCEPTION_PORT. A thread also has access to its task's special ports. The function returns KERN_SUCCESS if the port was returned and KERN_INVALID_ARGUMENT if thread is not a thread or which_port is an invalid port selector.

functionthread_set_special_port

extern kern_return_t thread_set_special_port(
	thread_act_t thr_act,
	int which_port,
	mach_port_t special_port
)
Set one of the special ports associated with the target thread.
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Set caller-specified special port belonging to the target thread.
The thread_set_special_port function sets a special port belonging to thread.
GNU Mach reference · 7.1.7 Thread Special Ports · © FSF, GFDL
kern_return_t thread_set_special_port(thread_t thread, int which_port, mach_port_t special_port)
The function thread_set_special_port sets one of a set of special ports for the thread specified by thread. The possible values for which_port are THREAD_KERNEL_PORT and THREAD_EXCEPTION_PORT. A thread also has access to its task's special ports. The function returns KERN_SUCCESS if the port was set and KERN_INVALID_ARGUMENT if thread is not a thread or which_port is an invalid port selector.

functionthread_set_exception_ports

extern kern_return_t thread_set_exception_ports(
	thread_act_t thread,
	exception_mask_t exception_mask,
	mach_port_t new_port,
	exception_behavior_t behavior,
	thread_state_flavor_t new_flavor
)
Set an exception handler for a thread on one or more exception types
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Set exception ports for a thread.
The thread_set_exception_ports function sets a specified set of exception ports belonging to thread.
Notes. If the value of the EXC_MACH_SYSCALL exception class exception port is the host name port, Mach kernel traps are executed by the kernel as expected; any other value causes the attempted execution of these system call numbers to be considered an exception. A "protected" exception port is one which cannot be fetched and for which exception processing cannot be aborted (thread_abort).

functionthread_get_exception_ports

extern kern_return_t thread_get_exception_ports(
	thread_act_t thread,
	exception_mask_t exception_mask,
	exception_mask_array_t masks, /* out */
	mach_msg_type_number_t *masksCnt,
	exception_handler_array_t old_handlers, /* out */
	exception_behavior_array_t old_behaviors, /* out */
	exception_flavor_array_t old_flavors /* out */
)
Lookup some of the old exception handlers for a thread
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Return a send right to an exception port.
The thread_get_exception_ports function returns send rights for a specified set of exception ports belonging to thread. The call returns a set of quadruples for each unique set of in effect for the thread where the exception type mask indicates for which exception types the other values apply.
KERN_EXCEPTION_PROTECTEDOne of the requested exception ports is protected and cannot be returned.

functionthread_swap_exception_ports

extern kern_return_t thread_swap_exception_ports(
	thread_act_t thread,
	exception_mask_t exception_mask,
	mach_port_t new_port,
	exception_behavior_t behavior,
	thread_state_flavor_t new_flavor,
	exception_mask_array_t masks, /* out */
	mach_msg_type_number_t *masksCnt,
	exception_handler_array_t old_handlers, /* out */
	exception_behavior_array_t old_behaviors, /* out */
	exception_flavor_array_t old_flavors /* out */
)
Set an exception handler for a thread on one or more exception types. At the same time, return the previously defined exception handlers for those types.
MIG routine from mach/thread_act.defs
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Swap exception ports for a thread.
The thread_swap_exception_ports function sets a specified set of exception ports belonging to thread, returning the old set.
Notes. If the value of the EXC_MACH_SYSCALL exception class exception port is the host name port, Mach kernel traps are executed by the kernel as expected; any other value causes the attempted execution of these system call numbers to be considered an exception. A "protected" exception port is one which cannot be fetched and for which exception processing cannot be aborted (thread_abort).
KERN_EXCEPTION_PROTECTEDOne of the requested exception ports is protected and cannot be returned.

functionthread_get_mach_voucher

extern kern_return_t thread_get_mach_voucher(
	thread_read_t thr_act,
	mach_voucher_selector_t which,
	ipc_voucher_t *voucher /* out */
)
MIG routine from mach/thread_act.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/thread.c
Returns a reference to the Mach voucher currently adopted by the target thread, or IPC_VOUCHER_NULL if the thread has none. The which selector is presently ignored; there is no distinction between the current and effective voucher. Returns KERN_INVALID_ARGUMENT for a null thread. The caller is responsible for releasing the returned voucher reference.

functionthread_set_mach_voucher

extern kern_return_t thread_set_mach_voucher(thread_act_t thr_act, ipc_voucher_t voucher)
MIG routine from mach/thread_act.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/thread.c
Adopts the specified voucher on the target thread, taking a reference on it and releasing the reference held on any previously adopted voucher; the thread's bank ledger and thread group are updated to those named by the new voucher. The target must be the calling thread or a thread that has not yet been started; otherwise KERN_INVALID_ARGUMENT is returned, as it is for a null thread.

functionthread_swap_mach_voucher

extern kern_return_t thread_swap_mach_voucher(
	thread_act_t thr_act,
	ipc_voucher_t new_voucher,
	ipc_voucher_t *old_voucher /* inout */
)
MIG routine from mach/thread_act.defs
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/thread.c
No longer supported. Historically adopted new_voucher on the target thread and returned the previously adopted voucher in old_voucher as an atomic swap. The routine now returns KERN_NOT_SUPPORTED unconditionally, releasing the reference passed in old_voucher.

functionthread_adopt_exception_handler

extern kern_return_t thread_adopt_exception_handler(
	thread_t thread,
	mach_port_t exc_port,
	exception_mask_t exc_mask,
	exception_behavior_t behavior_mask,
	thread_state_flavor_t flavor_mask
)
Calls thread_set_exception_ports on thread using a previously registered hardened exception handler. Only one hardened exception handler is allowed per task.
MIG routine from mach/thread_act.defs

functionthread_suspend2

extern kern_return_t thread_suspend2(
	thread_read_t target_act,
	mach_port_t *suspend_token /* out */
)
New thread suspend interface that returns a suspend token
MIG routine from mach/thread_act.defs

functionthread_resume2

extern kern_return_t thread_resume2(mach_port_t suspend_token)
New thread resume interface that takes a suspend token
MIG routine from mach/thread_act.defs