thread_suspend


Function - Suspend a thread.

SYNOPSIS

kern_return_t   thread_suspend
                (thread_act_t                     target_thread);

PARAMETERS

target_thread
[in thread send right] The thread to be suspended.

DESCRIPTION

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.

RETURN VALUES

Only generic errors apply.

RELATED INFORMATION

Functions: task_resume, task_suspend, thread_abort, thread_get_state, thread_info, thread_resume, thread_set_state, thread_terminate.