Re: clear_wait() using thread address
Re: clear_wait() using thread address
- Subject: Re: clear_wait() using thread address
- From: Michael Smith <email@hidden>
- Date: Tue, 11 Dec 2007 22:15:56 -0800
On Dec 10, 2007, at 9:27 PM, Vishal Shetye wrote:
How are you assuring that the thread wasn't already awoken and
already
terminated itself (in case of a process termination, system shutdown,
etc...)
I didn't find any function for getting thread state (like sleeping).
For now I just do a proc_find() and assume true return value = thread
sleeping (bad assumption). Please suggest alternative???
You must maintain this state yourself.
That being said, condvars were invented for a reason. Attempting to
determine the state of one thread from within another is intrinsically
race-prone, and if you ever find yourself thinking this would be a
good idea, it's time to toss out your design and start again.
I dropped wait_queue/clear_wait(). Now I use msleep()/
thread_wakeup_prim()
so that I wake up thread sleeping on particular condition.
These are not symmetrical. msleep() pairs with wakeup(), which you
should probably be using instead.
= Mike
_______________________________________________
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