RE: clear_wait() using thread address
RE: clear_wait() using thread address
- Subject: RE: clear_wait() using thread address
- From: "Vishal Shetye" <email@hidden>
- Date: Wed, 12 Dec 2007 17:36:47 +0530
Hi,
>> 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.
May be the design is not good but at least for now I'm only interested in
Checking if thread is sleeping on a particular event on not.
>These are not symmetrical. msleep() pairs with wakeup(), which you
>should probably be using instead.
Using wakeup caused some error while compiling (symbol DEBUG not found)
I used thread_wakeup_prim() as wakeup() has been defined in XNU as
void
wakeup(chan)
register void *chan;
{
thread_wakeup_prim((caddr_t)chan, FALSE, THREAD_AWAKENED);
}
_______________________________________________
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