RE: clear_wait() using thread address
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:references:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:x-mimeole:in-reply-to; bh=9zfOYp/Yy1xW/HkJ41dV1RzYgqKwgUmOgivr8J549bg=; b=Jyuvu4k8pHQDrHf6nkko1IZ2yTnko/RtBBK8WiINXmR8xRzOnNcyzlBWMyFhsrfxU1dp/lCeG1M2iy4sTS1OQGyLOqBlpuMG+EWTpl2HPGUUFO7QveFIH9rT/nq5qi1RGXSUHewpyWtvwv5z928LH1i9ryxsCSePUI+iOSPFGME= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:references:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:x-mimeole:in-reply-to; b=t38E4ibPau3NJLeZaxFrd+z1Hn+YH95j2L8Mqk8K9xbCPSAVmYaOPmQ3sNPw4k3J8E8HlOWKJ66EoKyP74Cu8/qElh1Wfn8pEMChUHvQAHUu0H+lMWYB6EAvmYhWKftFI3UJc3uUjofoCm0rf2Yz6zzYMyuGQzpY0x/tVLmbUyA= Thread-index: Acg8hoVQX3A+hFzfQKe26TA0KFS0uwALx25g 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 (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Vishal Shetye