Re: NSThreads
Re: NSThreads
- Subject: Re: NSThreads
- From: Dustin Voss <email@hidden>
- Date: Wed, 7 May 2003 18:59:24 -0700
On Wednesday, May 7, 2003, at 12:53 PM, Trevor Strohman wrote:
[snip]
However, I'd like to suggest some possible improvements. First, is it
necessary to update the status bar as fast as you can? Would you be
satisfied with an update every 1/4 second? That would use
significantly less CPU time. You can do that by putting:
[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.25]];
right before the [loopPool release] line.
An even simpler solution is to use NSTimer to send the increment
message every 1/4 second, which saves you the trouble of doing the
loop, thread, and autorelease pool stuff in the first place. However,
if increment is going to grow into something that takes some time, you
might want to keep the thread around.
If you use an NSTimer, I think you have to have a run-loop as well. And
if you have a run-loop, the auto-release solution will work just fine.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >Re: NSThreads (From: Trevor Strohman <email@hidden>) |