[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #28757] [NSThread sleepUntilDate:] in this example uses 100% of a C
[bug #28757] [NSThread sleepUntilDate:] in this example uses 100% of a CPU while sleeping on MinGW
Fri, 29 Jan 2010 17:46:44 +0000
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)
Follow-up Comment #2, bug #28757 (project gnustep):
Yes, it really does happen.
I looked at NSThread.m in the svn repository, and I agree with you that it
seems to reduce to a simple Sleep() call, which should work correctly.
However, I did notice one interesting thing. The MINGW32 code looks like
while (delay > 0)
delay = when - GSTimeNow();
If for some odd reason Sleep() returns early and doesn't sleep the "whole"
time, then the delay would be recalculated and the loop would continue again.
What you proposed was to print out what value is being passed to Sleep() for
each iteration, correct? This would require me to recompile GNUstep on mingw
(I believe). I'm not sure I really want to do this.
Finally, it seems that anytime I try to call [NSThread sleepUntilDate:d];
where d is greater than 1 second in the future, it pegs one processor for 100%
usage. Anything less than 1 second in the future and that problem disappears.
In either case, the method doesn't return until the proper amount of time has
passed, but CPU usage seems to be amiss in one of the cases.
Reply to this item at:
Message sent via/by Savannah