[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #28757] [NSThread sleepUntilDate:] in this example uses 100% of a C

From: Brock Erwin
Subject: [bug #28757] [NSThread sleepUntilDate:] in this example uses 100% of a CPU while sleeping on MinGW
Date: Fri, 29 Jan 2010 17:46:44 +0000
User-agent: 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)
    Sleep (delay*1000);
    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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]