On Thu, Sep 25, 2008 at 4:07 PM, Karan, Cem (Civ, ARL/CISD)
<[EMAIL PROTECTED]> wrote:
> I've got a class that acts like a super-lightweight server within my program. 
>  It listens for incoming packets of information, decodes them, and then tells 
> the rest of my code that something changed.  So far, this sounds like a job 
> for NSNotificationCenter, except that I'm getting the packets by UDP, and 
> don't want to tell all the listeners about every single update that happens; 
> it would be better to coalesce them into one notification and notify them 
> when the run loop is idle.  OK, so this sounds perfect for 
> NSNotificationQueue with 
> (NSNoticationCoalescingOnName|NSNotificationCoalescingOnSender) as the 
> options.  The problem is that I want to send all the data along in the user 
> dictionary.  How is that coalesced?  Note that I want ALL the data I'm 
> putting in the dictionary, not just the last user dict.

I have to wonder, why are you coalescing these things at all? You *do*
want to tell them about every single update that happens, as far as I
can see, since that is essentially what your user info dictionary
contains. You want to tell them about multiple messages using a single
notification, but why? Just send the multiple notifications and be
happy. There's no effective difference between sending one
notification with multiple data items and sending multiple
notifications with one data item each. Coalescing is useful when you
have many notifications which each trigger an identical, idempotent
action such that getting a bunch in a row would be redundant. That's
not the case for what you're doing.

Mike
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to