• 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: Question on thread communication
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on thread communication


  • Subject: Re: Question on thread communication
  • From: Karim Morsy <email@hidden>
  • Date: Mon, 17 Apr 2006 23:38:18 +0200

Chris,

thanks for the comment on my post.
in fact, I could have just performed the method on the object directly, but my goal was to decouple the objects as much as possible.
I think NSNotificationcenter is a great way to achieve this.


Karim

On Apr 17, 2006, at 7:51 PM, Chris Kane wrote:

To add another comment for the archives ...
It works, but there's no reason to go indirectly through the notification center, if you have only one thing that needs to react to the notification (though it's not clear you do, you say "handler method" -- singular). You could just perform a method on that object directly, passing whatever argument you like.


That avoids the indirection of the notification object (and packaging in the userInfo dictionary whatever "results" you might want to send from the background thread to the main thread), and the hassle of adding the recipient object to the notification center and removing it later.


Chris Kane Cocoa Frameworks, Apple


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Question on thread communication (From: Chris Kane <email@hidden>)

  • Prev by Date: Re: Cocoa Books
  • Next by Date: Re: Cocoa Books
  • Previous by thread: Re: Question on thread communication
  • Next by thread: addObserver:forKeyPath:options:context
  • Index(es):
    • Date
    • Thread