NAME
thread_suspend - suspends specified thread

SYNOPSIS
#include <mach.h>

kern_return_t thread_suspend(target_thread);
thread_t target_thread;

ARGUMENTS
target_thread The thread to be suspended.

DESCRIPTION
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 supend within the kernel code. In either case, when the
thread is resumed the system trap will return. This could cause
unpredictible 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.

DIAGNOSTICS
KERN_SUCCESS The thread has been suspended.

KERN_INVALID_ARGUMENT target_thread is not a thread.

SEE ALSO
task_suspend(2), task_resume(2), thread_info(2), thread_state(2),
thread_resume(2), thread_terminate(2), thread_abort(2)