Re: Preventing beach balls
Re: Preventing beach balls
- Subject: Re: Preventing beach balls
- From: Paul Borokhov <email@hidden>
- Date: Mon, 19 Feb 2007 13:22:17 -0800
Right...looks like rolling this stuff off onto a separate thread will be easiest (btw, the thing I'm doing is running a loop walking down the tree of an XML doc...so I think it's easier to just keep it all in one step rather than breaking it up).
Now does anyone have answers to my keychain question (in another thread) ? ;)
Paul
----------Original Message----------
On 2/19/07 16:12 , Sherm Pendley (email@hidden) wrote:
> On Feb 19, 2007, at 1:43 PM, Paul Borokhov wrote:
>
>> On 2/19/07 17:50 , Martin Wennerberg (email@hidden) wrote:
>>> It might be easier for you to split the work into smaller chunks and
>>> use an NSTimer to do it asynchronously on the main thread.
>>
>> 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?
>
> You missed the part about splitting the work into smaller chunks. The
> idea here is that each call to -foo will do a little bit of the work,
> not enough to block the runloop and trigger a beach ball.
>
> sherm--
>
> Web Hosting by West Virginians, for West Virginians: http://wv-www.net
> Cocoa programming in Perl: http://camelbones.sourceforge.net
>
>
_______________________________________________
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