Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Questions about NSDistributedNotificationCenter



-----Original Message-----

>From: Lloyd Sargent <email@hidden>
>Subject: Questions about NSDistributedNotificationCenter

>Got a couple of quick questions about NSDistributedNotificationCenter:

>1. Is this the "normal" method of passing simple "messages" between
>threads?

I have noticed that these notifications are picked up by the run loop in
the main thread but would not be picked up by the run loops in secondary
threads.

In other words, if you create Obj-C object that runs default thread run loop
in detached thread selector parameter (which is one of object's methods) and
which also subscribes to NSDistributedNotificationCenter notifications, it
will never get them.

Run loop in the main thread has no such problems.

So, rather than answering your questions I'm afraid I must add that this is
not well documented. Distributed notification center can be used for
inter-process communication (several of us actually use it for IPC and
synchronization and proper timeouts are the major hurdles that we
encountered) but for in-process intra-thread communication local
notification center should be sufficient. Threading rules and affinities are
unknown at this time.

Tony




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.