Re: Posting notifications
Re: Posting notifications
- Subject: Re: Posting notifications
- From: Keary Suska <email@hidden>
- Date: Mon, 25 Jan 2010 08:36:08 -0700
On Jan 25, 2010, at 7: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]
>
> I was wondering exactly what "and processed" included in the statement
> above.
Until the observer's notification method returns.
> If I post a named notification to the appDelegate and that delegate, upon receipt, immediately calls func1() which calls func2() etc. where does this "processed" chain stop?
It doesn't until the original appDelegate method returns.
> What if this chain terminates with exactly the same notification that started it?
Not sure what you mean. If the same notification is sent before the original method returns, the whole chain executes again, potentially recursively.
> Does this all build up a long, unterminated chain or does it end earlier somehow?
It will not end until you run out of stack space and your app crashes. I expect the docs are just there to explain the API, and not necessarily to let you know how much rope you are given to hang yourself with ;-)
I think it is best to equate a notification with a plain method call. Except that I have found Cocoa doesn't like nesting notifications much.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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