On Jan 25, 2010, at 6:21 AM, McLaughlin, Michael P. wrote:
"A notification center delivers notifications to observers
synchronously. In
other words, when posting a notification, control does not return to
the
poster until all observers have received *and processed* the
notification."
[my emphasis]
Don't read too much into this — it's just regular function calls. When
you post the notification, NSNotification iterates over all the
observers and calls their notification methods one at a time, then
returns back to you.
This usually works fine. But if you're posting a notification and
don't want to be blocked right then, or if you want to coalesce
multiple posts of the same notification so observers are called only
once, have a look at NSNotificationQueue.
As an observer, if you find that you have a lot to do in response to a
notification and it's taking too long (or ends up making re-entrant
calls that confuse the calling code), you can change your observer
method to just call performSelector:afterDelay:, to defer the actual
processing.
—Jens_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com