Re: Best pattern to follow for scheduling an event
Re: Best pattern to follow for scheduling an event
- Subject: Re: Best pattern to follow for scheduling an event
- From: glenn andreas <email@hidden>
- Date: Thu, 8 Nov 2007 12:57:07 -0600
On Nov 8, 2007, at 12:43 PM, John Stiles wrote:
I think I'm not explaining myself well enough.
The typical pattern is that my method will get spammed a hundred
times in quick succession. After the burst of calls has completed, I
want to do fix-up. Technically, I could do my fix-ups after every
single call, but that would probably be slow so I want to avoid it.
This doesn't mean that the method will never get called again—much
later on in app execution, it's quite possible that my method will
suddenly get spammed again with hundreds of calls, and then I will
want to do fix-ups again.
Then have you doFixUp: routine reallocate the m_deferredFixupTimer, so
the next time that the "do something" trigger is hit, it can be
scheduled again.
There is an inferred state that if m_deferredFixupTimer were nil,
there is a pending cleanup, otherwise it means that the thing is
currently clean (and the next time it made dirty, it will schedule a
cleanup)
You could even tweak the date value to guarantee that, for example,
the cleanup only happens once every 5 seconds... (if, for example,
part of the cleanup is to tell the user something has been updated)
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next
generation of fractal art
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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