Re: clear_wait() using thread address
Re: clear_wait() using thread address
- Subject: Re: clear_wait() using thread address
- From: Jim Magee <email@hidden>
- Date: Mon, 10 Dec 2007 17:21:09 -0500
On Dec 7, 2007, at 6:09 AM, Vishal Shetye wrote:
I've written a KEXT, wherein a thread, sleeping on wait_queue is
invoked by
another thread using clear_wait(). For this I keep a global thread
safe
structure for storing thread's address.
What I want to know is,
* Is there a possibility that my thread reference may become invalid,
because of kernel's internal memory movement (such as to defragment,
I'm
just guessing)?
A thread's kernel address is valid for as long as someone holds a
reference to it. Valid, executing threads always hold references on
themselves. But there's the rub. How are you assuring that the
thread wasn't already awoken and already terminated itself (in case of
a process termination, system shutdown, etc...). Are you taking a
reference on the thread?
More importantly, are you really intending to wake the thread from any
wait it might be performing - even ones unrelated to the condition
that (you think) the thread might be waiting on? It is always better
to post the specific condition than to try and determine and then
blast a particular thread.
* Is there a way of invoking selected process from wait_queue by its
pid
(like wake_up_process() in case of linux).
In Darwin/Mac OS X, processes can have many threads. Each waits
independently. There is no wake_up_process(). I'm sure even Linux
isn't happy with that legacy API given its current trend towards
native threads as well.
--Jim
_______________________________________________
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