Re: How can I get notified that a kernel thread has been terminated ?
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Doesn't that still leave a race condition? After the flag is set, it will take an unknowable amount of time for the thread to finish exiting the thread function. The thread could execute code after the kext unloads. As an OSX kernel newbie I'm surprised that I don't see a conventional way to rendezvous on thread termination. I do see thread_getstatus, which could be used in a wait loop until it returns KERN_TERMINATED, but it doesn't seem to be exported. -Gary On Aug 5, 2011, at 1:11 PM, Roman Zippel wrote:
On 05.08.2011 09:34, Nicolas Connoud wrote:
I have tried that. The kext-unload waits for a flag to be set (this is the last thing my thread function does) before carrying on with the unload. Still it is not enough.
There may also be race conditions at how you set the flag. The easiest answer is probably to use an IOLock. This way you can force the unload function to sleep until it's woken up by the thread. If the last call in the thread is an IOLockUnlock() call, you should be fine.
bye, Roman _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/gary%40berktool.com
This email sent to gary@berktool.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Gary Kratkin