Re: Preventing beach balls
Re: Preventing beach balls
- Subject: Re: Preventing beach balls
- From: Shawn Erickson <email@hidden>
- Date: Mon, 19 Feb 2007 12:38:43 -0800
On Feb 19, 2007, at 10:43 AM, Paul Borokhov wrote:
Hmm...how exactly would I go about doing this? Currently I have
...
timer = [[NSTimer alloc] initWithFireDate:[NSDate
dateWithTimeIntervalSinceNow:delay] interval:[[NSUserDefaults
standardUserDefaults] integerForKey:@"updateTime"] target:self
selector:@selector(foo:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer
forMode:NSDefaultRunLoopMode];
...
and then
- (void) foo:(NSTimer *)aTimer {
...
[self bar];
... }
If "bar" takes too long, the interface freezes. What am I missing?
A given thread can only do one thing at a time. In this case the main
thread is busy in "bar". You either have to make "bar" take less time
(do less work in a single shot) for this method to work or roll it
off into another thread.
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden