Re: NSApp with wrong _running count
Re: NSApp with wrong _running count
- Subject: Re: NSApp with wrong _running count
- From: Chris Hanson <email@hidden>
- Date: Tue, 20 May 2008 15:25:12 -0700
On May 20, 2008, at 4:51 AM, Micha Fuhrmann wrote:
many thanks, now, what else can I use that's thread safe for that
matter?
Don't structure your code such that you would be putting up an alert
from a non-main thread.
If you keep to strict MVC, you can design your application such that
model-level work can be done on one or more non-main threads via
NSOperationQueue (or your own work queue implementation if you're not
targeting Leopard), while user interaction can happen on the main
thread.
One common technique for this is "snapshotting." In the main thread,
take a snapshot of some model-level state you need to modify. Pass
that snapshot to an operation which manipulates it on some other
thread. When that operation is done, the modified snapshot's changes
are merged back on the main thread.
-- Chris
_______________________________________________
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