Re: How to kill an IOKit thread?
Re: How to kill an IOKit thread?
- Subject: Re: How to kill an IOKit thread?
- From: Jim Magee <email@hidden>
- Date: Wed, 31 Jul 2002 15:30:38 -0400
On Wednesday, July 31, 2002, at 02:53 PM, Heiko Panther wrote:
I'm using an IOKit thread in my kext. The thread usually blocks in a
system call.
From my main workloop, I want to terminate the thread on certain
conditions. There is an explanation on how to do so in IMX:Kernel
Programming.
thread_terminate(getact_thread(thread_t thread));
Only problem: I can't seem to find the function getact_thread(). Any
clues? How do I get rid of the thread?
I'm confused. If it is an IOKit thread created by a KEXT, it can't be
blocked in a system call.
Regardless of that little confusion, it is always best to let the
thread terminate itself. Simply wake it up from that block such that
it notices it should kill itself. Then just have it call
thread_terminate(current_act()). If it truly is a kernel thread, it
will not return from this call. However, if it really is user-level
thread, the thread will only be marked for termination, and will not
terminate until it unwinds out of its current system call. It will
stop just short of returning to user-space and then will finish the job
of terminating itself.
--Jim
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.