• 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: NSNotificationCenter : multiple messages sent to the same observer?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNotificationCenter : multiple messages sent to the same observer?


  • Subject: Re: NSNotificationCenter : multiple messages sent to the same observer?
  • From: Iceberg-Dev <email@hidden>
  • Date: Sun, 22 Feb 2009 19:23:38 +0100


On Feb 22, 2009, at 7:06 PM, Bill Bumgarner wrote:

On Feb 22, 2009, at 9:59 AM, Iceberg-Dev wrote:
[...]
The current behavior makes it possible to implement architectures where a client could take "more action" for any given notification by registering more than once. Not supporting this pattern would make such a pattern significantly more inconvenient to implement.

As well, any kind of a coalescing in the notification center is going to increase the complexity/overhead of the observer and, in particularly, might likely impact notification delivery speed (or, alternatively, require the notification center to use a bunch more memory to differentiate between "set of registered observers" and "list of observers that I actually deliver stuff to").

I think it would just require to make the search once on registration, not every time a notification is sent.

Assuming that your statement is made in light of trying to avoid the bloat I alluded to in the previous paragraph, this would lead to some very surprising behavior.


Imagine this sequence of calls...

- (void)addObserver:self selector:(SEL)aSelector name:BobsYourUncleNotification object:(id)anObject;
- (void)addObserver:self selector:(SEL)aSelector name:BobsYourUncleNotification object:(id)anObject;
- (void)removeObserver:self name:BobsYourUncleNotification object: (id)anObject;


If the notification center coalesced observers on registration, the above would mean that the notification would no longer be sent.

If anObject is the same object in the 3 calls, this is probably already the case if I am to believe the documentation. Which is the behavior I would expect/wish for.
_______________________________________________


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: NSNotificationCenter : multiple messages sent tothe same observer?
      • From: "Paul Sanders" <email@hidden>
    • Re: NSNotificationCenter : multiple messages sent to the same observer?
      • From: Bill Bumgarner <email@hidden>
References: 
 >NSNotificationCenter : multiple messages sent to the same observer? (From: Iceberg-Dev <email@hidden>)
 >Re: NSNotificationCenter : multiple messages sent to the same observer? (From: Michael Ash <email@hidden>)
 >Re: NSNotificationCenter : multiple messages sent to the same observer? (From: Iceberg-Dev <email@hidden>)
 >Re: NSNotificationCenter : multiple messages sent to the same observer? (From: Bill Bumgarner <email@hidden>)
 >Re: NSNotificationCenter : multiple messages sent to the same observer? (From: Iceberg-Dev <email@hidden>)
 >Re: NSNotificationCenter : multiple messages sent to the same observer? (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: How to get strings like <CSSDictionary: 0x126a70> for all objects
  • Next by Date: Re: Programmatically opening an NSComboBox list
  • Previous by thread: Re: NSNotificationCenter : multiple messages sent to the same observer?
  • Next by thread: Re: NSNotificationCenter : multiple messages sent to the same observer?
  • Index(es):
    • Date
    • Thread