I have a Cocoa app that uses a dedicated thread to receive messages, and I 
would 
like that thread to post those messages as notifications so they can be 
processed asynchronously, outside my receiving loop (but not on the main 
thread).

Looking at NSNotificationQueue, I'm totally confused by it. I searched for a 
code example of how it interfaces with NSNotificationCenter but couldn't find 
one complete enough to implement.

So... since notifications are executed on the thread that enqueued the 
notification, would it be okay to do the following within my receiving loop:

1. Receive a message
2. Package the message into a NSData object
3. Use -performSelectorInBackground:withObject: to invoke a method that posts a 
notification to the default notification center. 
4. The notification is processed asynchronously in the background thread, and 
exits.

Would this approach work to achieve async notification processing?
-Jon



      
_______________________________________________

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

Reply via email to