Re: clear_wait() using thread address
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com On Dec 10, 2007, at 9:27 PM, Vishal Shetye wrote: 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. = Mike _______________________________________________ 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... How are you assuring that the thread wasn't already awoken and already terminated itself (in case of a process termination, system shutdown, etc...) 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. This email sent to site_archiver@lists.apple.com
participants (1)
-
Michael Smith