Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
IOSleep vs IODelay
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

IOSleep vs IODelay



Hello developers,
I need to poll a status register for a condition that can take from 32us up to 16ms depending on a number of entries.
I was using IOSleep( max(1, num * 32 / 1000) ) in loop while checking for the condition.
It works but I was wondering if I should use IODelay when num is small?

int loop = 4;
int num;
while ( --loop && !condition(&num) )
{
if (num < 20)
IODelay(num * 32);
else
IOSleep( max(1, num * 32 / 1000) );
}

Or should I just poll the condition with no sleep, no delay when num is small, and use IOSleep when num is above 31?
Thanks for your advice,
Anthony



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.