• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Best pattern to follow for scheduling an event
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:37:17 -0600


On Nov 8, 2007, at 12:27 PM, John Stiles wrote:

Would this work more than once?
The current code works if you call it multiple times in a row.
With a non-repeating timer, the docs say it will invalidate itself as soon as it has fired.


So, assuming I'm following this correctly, the cleanup happens only once, at the next run of the event loop, even though it may be requested multiple times (both between the first call and the time it actually runs, as well as after it has already run once). Then the init part would be:

m_deferredFixupTimer = [[NSTimer alloc] initWithFireDate: [NSDate distantFuture] interval: 0 target: myObject selector: @selector(doFixUp:) userInfo: NULL repeats: NO];
[[NSRunLoop currentRunLoop] addTimer: m_deferredFixupTimer forMode: NSDefaultRunLoopMode];



and then "trigger" part would be: [m_deferredFixupTimer setFireDate: [NSDate date]]; [m_deferredFixupTimer release]; m_deferedFixupTimer = nil;

After the first time it is triggered, the thing will be nil, so no problem...



Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | flame : flame fractals & strange attractors : build, mutate, evolve, animate




_______________________________________________

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


  • Follow-Ups:
    • Re: Best pattern to follow for scheduling an event
      • From: John Stiles <email@hidden>
References: 
 >Best pattern to follow for scheduling an event (From: John Stiles <email@hidden>)
 >Re: Best pattern to follow for scheduling an event (From: glenn andreas <email@hidden>)
 >Re: Best pattern to follow for scheduling an event (From: John Stiles <email@hidden>)

  • Prev by Date: Re: Redraw Problem with Layer-Backed View in Scroll View
  • Next by Date: Re: NSOpenGLView overlap
  • Previous by thread: Re: Best pattern to follow for scheduling an event
  • Next by thread: Re: Best pattern to follow for scheduling an event
  • Index(es):
    • Date
    • Thread