• 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: Multithreaded Cocoa Document Application?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multithreaded Cocoa Document Application?


  • Subject: Re: Multithreaded Cocoa Document Application?
  • From: Uli Kusterer <email@hidden>
  • Date: Mon, 27 Aug 2007 19:15:06 +0200

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


  • Follow-Ups:
    • Re: Multithreaded Cocoa Document Application?
      • From: Andrew Merenbach <email@hidden>
References: 
 >Multithreaded Cocoa Document Application? (From: "Rick Ekle" <email@hidden>)
 >Re: Multithreaded Cocoa Document Application? (From: Andrew Merenbach <email@hidden>)

  • Prev by Date: Re: Newbie question about _NSSize and NSSize
  • Next by Date: Re: Multithreaded Cocoa Document Application?
  • Previous by thread: Re: Multithreaded Cocoa Document Application?
  • Next by thread: Re: Multithreaded Cocoa Document Application?
  • Index(es):
    • Date
    • Thread