Re: Tight loop processing
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