thread_halt_self - General: Handles asynchronous traps for
self-terminating kernel threads
The thread_halt_self routine performs the work associated
with a variety of asynchronous traps (ASTs) for a kernel
thread that terminates itself. A kernel thread terminates
itself (or one kernel thread terminates another kernel
thread) by calling the thread_terminate routine.
The thread_halt_self routine examines the AST-related member
of the thread structure pointer associated with the
kernel thread that wants to terminate itself. This thread
structure pointer was returned in a previous call to kernel_isrthread
or kernel_thread_w_arg and passed by you to
the thread_terminate routine. This AST-related member is
set to a bit that identifies the specific AST trap associated
with this kernel thread. Based on the AST bit set in
this member, thread_halt_self does the appropriate cleanup
work before the kernel thread exits from the kernel.
A kernel thread that terminates itself must call
thread_halt_self immediately after the call to thread_terminate.
The reason for this is that thread_terminate only
prepares the self-terminating kernel thread to stop execution.
The thread_halt_self routine completes the work
needed to stop execution of the self-terminating kernel
thread by performing the appropriate cleanup work.
[ Back ]