Re: How can I get notified that a kernel thread has been terminated ?
Re: How can I get notified that a kernel thread has been terminated ?
- Subject: Re: How can I get notified that a kernel thread has been terminated ?
- From: Gary Kratkin <email@hidden>
- Date: Fri, 05 Aug 2011 13:23:20 -0300
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 (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden