Re: Multithreaded Cocoa Document Application?
Re: Multithreaded Cocoa Document Application?
- Subject: Re: Multithreaded Cocoa Document Application?
- From: Andrew Merenbach <email@hidden>
- Date: Mon, 27 Aug 2007 10:22:38 -0700
Ah, right, Distributed Objects.... that's where I got confused.
Cheers,
Andrew
On Aug 27, 2007, at 10:15 AM, Uli Kusterer wrote:
On 24.08.2007, at 03:11, Andrew Merenbach wrote:
I'm not an expert on interthread communication, but I believe that
you may wish to look into NSDistributedNotifications for this:
Distributed *objects* were the old way to do this, maybe you were
thinking of that? But I vaguely remember having heard that it was
not recommended to use DO for inter-thread communication these
days. performSelectorOnMainThread: and similar NSThread-related
methods are apparently what one should use these days.
As others have said, while BeOS was apparently designed so you
could have entire windows run on separate threads, in Cocoa and
AppKit you're generally encouraged to use locks (or @synchronized),
and to only start a particular *operation* on separate threads.
Just kicking off a thread when needed and sending a message to the
main thread occasionally for progress information or to indicate
you've finished should be the easiest way to not block the UI and
still do work in the background. Having some kind of message queue
can come in handy there if you do this frequently and with lots of
small operations, or interdependent operations, or with several
tasks across different documents, and you want to start only as
many as you have CPUs or so.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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