Accuracy of NSThread sleepUntilDate
Accuracy of NSThread sleepUntilDate
- Subject: Accuracy of NSThread sleepUntilDate
- From: Christian Mike <email@hidden>
- Date: Fri, 3 Aug 2001 08:03:06 -0500
I have a multithreaded application in which the threads will sometimes delay
for a short time. I use the code:
NSTimeInterval timeInterval = (NSTimeInterval) someMilliseconds /
1000.0;
[NSThread sleepUntilDate:[NSDate
dateWithTimeIntervalSinceNow:timeInterval]];
Now I am not look for high accuracy here. I realize that when you give up
the processor in a multithreaded application that all bets are off. I am
just looking for some ball park answer about how accurate this delay
mechanism is. What is a reasonably expected quantization unit here?
Is there some better way to put a thread to sleep for a short (10's of
milliseconds) time?
Thanks.
Michael Christian
Thomson multimedia Inc.