• 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: Tight loop processing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tight loop processing


  • Subject: Re: Tight loop processing
  • From: Brian Stern <email@hidden>
  • Date: Thu, 10 Apr 2008 15:49:43 -0400


On Apr 10, 2008, at 2:00 PM, Don Arnel wrote:
I've got a Cocoa application which runs a simulation loop 1000s of times. Of course, this prevents any user interaction with the rest of the program while the simulation is running. When I was programming for Windows there was a call in Visual Basic (app.DoEvents()) which would process any pending events. You could put DoEvents() inside long loops to prevent blocking user input. Is there a similar way to handle this in Cocoa?

NSTimer may be a simple way to implement this. Your code is called back by the timer at the specified interval. Your code would probably run one iteration of the simulation at each callback. User interface events would be processed between timer callbacks. Coding this is likely to be simpler than using threads.


http://developer.apple.com/documentation/Cocoa/Conceptual/Timers/Timers.html

--
Brian Stern
email@hidden



_______________________________________________

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: Tight loop processing
      • From: Wade Tregaskis <email@hidden>
References: 
 >Tight loop processing (From: Don Arnel <email@hidden>)

  • Prev by Date: Re: ObjC static member variable
  • Next by Date: Re: ObjC static member variable
  • Previous by thread: Re: Tight loop processing
  • Next by thread: Re: Tight loop processing
  • Index(es):
    • Date
    • Thread