Re: IOLockSleepDeadline example in docu is wrong (won't compile)
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UaIactdiRlJArLXTEjv6o2S0IMGckCAKhstLbP4S5yXWgQ6WD8spOwhUViupgIWIKF2bW4njaFRQQLGyWl3riF98s+uQHAatetfcpJg24aQEQdlowCMM+NfzvTWb75tbTtob3lkg0zNaJBUmN+Jr+FgRg5mWxoce/CIW+uimHWw= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Qxd9Vtcse5lLmC3lJovnRNHpjXN34O9XLde5bwg1l5IBhIJgNS3iFx0YlBxRDGR5KnwuqgnS94bJMdpWGMO1IPf0++GCwWDij9YAVM+TeRSNfS2EwkKtEp4ImDvqfKGscBhjqDy8UlaGqHAbeKnNxdO77UnSTwUlQrDSqiWMoAE=
So as someone suggested, I'm now using IOSleep instead
:) I should only have suggested IOSleep @+ spin doctors cheers ! On 9/5/07, Shaun Wexler <dev@macfoh.com> wrote:
On Sep 5, 2007, at 2:10 PM, Shaun Wexler wrote:
IODelay could have been implemented as an inline spin loop which reads the timebase registers, but it was not, thus the documentation is somewhat misleading.
There is no underlying difference between IOSleep and IODelay functions, except for the granularity of their argument (mS vs µS). They both call down to clock_delay_until(), which sleeps the calling thread if preemption is enabled or the sleep time is longer than the duration of (8x) context switches, etc.
That should read "and", not "or".
Use IODelay if you need to sleep/spin for times and/or granularities less than 1 ms, else use IOSleep.
To clarify, if preemption is disabled prior to calling IOSleep or IODelay, you will in fact get a "friendly spin" which calls cpu_pause in a loop, and your thread will remain on the current cpu/core, until the deadline expires.
The IODelay function should probably be modified to disable preemption across the call, making it behave as-per documentation.
-- Shaun Wexler MacFOH http://www.macfoh.com
_______________________________________________ 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/openspecies%40gmail.com
This email sent to openspecies@gmail.com
-- http://openspecies.googlepages.com/gpgkey.txt _______________________________________________ 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)
-
mm w