• 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: "Shawn Erickson" <email@hidden>
  • Date: Thu, 10 Apr 2008 11:23:08 -0700

On Thu, Apr 10, 2008 at 11:14 AM, Don Arnel <email@hidden> wrote:
> I thought maybe there was a simple message I could send to NSApp, but it
> looks like putting the loop in a new thread is the way to go.  Thanks!

Likely throwing this loop off to an NSThread is the cleanest and most
efficient solution (allows UI to respond and the simulation to run
concurrently, most Macs are at least dual core these days).

You can inform your UI of work status, etc. by using -[NSObject
performSelectorOnMainThread:withObject:waitUntilDone:] since you
(normally) want to manipulate Cocoa UI on while running in the context
of the main thread.

You could attempt to run the work loop periodically in your simulation
loop if you don't want to use a secondary thread. Look at the docs for
NSRunLoop.

Also I suggest you review...
<http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/Introduction/chapter_1_section_1.html>

-Shawn
_______________________________________________

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

References: 
 >Tight loop processing (From: Don Arnel <email@hidden>)
 >Re: Tight loop processing (From: Jamie Phelps <email@hidden>)
 >Re: Tight loop processing (From: Don Arnel <email@hidden>)

  • Prev by Date: A simple Objective-C question
  • Next by Date: Re: Tight loop processing
  • Previous by thread: Re: Tight loop processing
  • Next by thread: Re: Tight loop processing
  • Index(es):
    • Date
    • Thread