Heiko Panther writes:
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?
Just get the thread to call IOExitThread (); Eg, I have a thread which wakes up periodically. When it wakes up, one of the things it checks for is a "should_exit" flag: Eg: Module termination code: mydriver_port_reaper_should_exit = 1; while (!mydriver_port_reaper_exited) { IOSleep (1 * MS_PER_SEC); } Thread function: { while (!mydriver_port_reaper_should_exit) { <...> IOSleep (5 * MS_PER_SEC); } mydriver_port_reaper_exited = 1; IOExitThread (); } Cheers, Drew _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.