![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/share/doc/gnustep-base-doc/Base/Reference/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> NSDistributedNotificationCenter class reference </title> </head> <body> <font face="serif"> <a href="Base.html">Up</a> <br /> <h1><a name="title$NSDistributedNotificationCenter"> NSDistributedNotificationCenter class reference </a></h1> <h3>Authors</h3> <dl> <dt>Richard Frith-Macdonald (<a href="mailto:richard@brainstorm.co.uk"><code>richard@brainstorm.co.uk</code></a>)</dt> <dd> </dd> </dl> <p><b>Copyright:</b> (C) 1998-2009 Free Software Foundation, Inc.</p> <div> </div> <h1><a name="001000000000"> Software documentation for the NSDistributedNotificationCenter class </a></h1> <h2><a name="class$NSDistributedNotificationCenter">NSDistributedNotificationCenter</a> : <a rel="gsdoc" href="NSNotification.html#class$NSNotificationCenter">NSNotificationCenter</a></h2> <blockquote class="declared"> <dl> <dt><b>Declared in:</b></dt> <dd>Foundation/NSDistributedNotificationCenter.h</dd> </dl> </blockquote> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> </p> <p> The <code>NSDistributedNotificationCenter</code> provides a versatile yet simple mechanism for objects in different processes to communicate effectively while knowing very little about each others' internals. <br /> A distributed notification center acts much like a normal notification center, but it handles notifications on a machine-wide (or local network wide) basis rather than just notifications within a single process. Objects are able to register themselves as observers for particular notification names and objects, and they will then receive notifications (including optional user information consisting of a dictionary of property-list objects) as they are posted. </p> <p> </p> <p> Since posting of distributed notifications involves inter-process (and sometimes inter-host) communication, it is fundamentally slower than normal notifications, and should be used relatively sparingly. In order to help with this, the <code>NSDistributedNotificationCenter</code> provides a notion of 'suspension', whereby a center can be suspended causing notifications for observers in the process where the center was suspended to cease receiving notifications. Observers can specify how notifications are to be handled in this case (queued or discarded) and posters can specify that particular notifications are to be delivered immediately irrespective of suspension. </p> <p> </p> <p> Distributed notifications are mediated by a server process which handles all notifications for a particular center type. In GNUstep this process is the <code>gdnc</code> tool, and when started without special options, a gdnc process acts as the local centre for the host it is running on. When started with the <code>GSNetwork</code> user default set to <code>YES</code>, the <code>gdnc</code> tool acts as a local network wide server (you should only run one copy of <code>gdnc</code> like this on your LAN). <br /> The <code>gdnc</code> process should be started at machine boot time, but GNUstep will attempt to start it automatically if it can't find it. </p> <p> </p> <p> MacOS-X currently defines only a notification center for the local host. GNUstep also defines a local network center which can be used from multiple hosts. By default the system sends this to any gdnc process it can find which is configured as a network-wide server, but the <code>GDNCHost</code> user default may be used to specify a particular host to be contacted... this may be of use where you wish to have logically separate clusters of machines on a shared LAN. </p> <p> </div> <hr width="50%" align="left" /> <a href="#_NSDistributedNotificationCenter_ivars">Instance Variables</a> <br/><br/> <b>Method summary</b> <ul> <li><a rel="gsdoc" href="NSDistributedNotificationCenter.html#method$NSDistributedNotificationCenter+defaultCenter">+defaultCenter</a></li> <li><a rel="gsdoc" href="NSDistributedNotificationCenter.html#method$NSDistributedNotificationCenter+notificationCenterForType$">+notificationCenterForType:</a></li> <li><a rel="gsdoc" href="NSDistributedNotificationCenter.html#method$NSDistributedNotificationCenter-addObserver$selector$name$object$">-addObserver:selector:name:object:</a></li> <li><a rel="gsdoc" href="NSDistributedNotificationCenter.html#method$NSDistributedNotificationCenter-addObserver$selector$name$object$suspensionBehavior$">-addObserver:selector:name:object:suspensionBehavior:</a></li> <li><a rel="gsdoc" href="NSDistributedNotificationCenter.html#method$NSDistributedNotificationCenter-postNotification$">-postNotification:</a></li> <li><a rel="gsdoc" href="NSDistributedNotificationCenter.html#method$NSDistributedNotificationCenter-postNotificationName$object$">-postNotificationName:object:</a></li> <li><a rel="gsdoc" href="NSDistributedNotificationCenter.html#method$NSDistributedNotificationCenter-postNotificationName$object$userInfo$">-postNotificationName:object:userInfo:</a></li> <li><a rel="gsdoc" href="NSDistributedNotificationCenter.html#method$NSDistributedNotificationCenter-postNotificationName$object$userInfo$deliverImmediately$">-postNotificationName:object:userInfo:deliverImmediately:</a></li> <li><a rel="gsdoc" href="NSDistributedNotificationCenter.html#method$NSDistributedNotificationCenter-removeObserver$name$object$">-removeObserver:name:object:</a></li> <li><a rel="gsdoc" href="NSDistributedNotificationCenter.html#method$NSDistributedNotificationCenter-setSuspended$">-setSuspended:</a></li> <li><a rel="gsdoc" href="NSDistributedNotificationCenter.html#method$NSDistributedNotificationCenter-suspended">-suspended</a></li> </ul> <hr width="50%" align="left" /> <div class="method"> <h3><a name="method$NSDistributedNotificationCenter+defaultCenter">defaultCenter </a></h3> + (id) <b>defaultCenter</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Returns the default notification center... a shared notification center for the local host. This is simply a convenience method equivalent to calling <a rel="gsdoc" href="#method$NSDistributedNotificationCenter+notificationCenterForType$"> +notificationCenterForType: </a> with <code>NSLocalNotificationCenterType</code> as its argument. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDistributedNotificationCenter+notificationCenterForType$">notificationCenterForType: </a></h3> + (<a rel="gsdoc" href="#class$NSDistributedNotificationCenter">NSDistributedNotificationCenter</a>*) <b>notificationCenterForType:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)type;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Returns a notification center of the specified <var>type</var>. <br /> The <code>NSLocalNotificationCenterType</code> provides a shared access to a notification center used by processes on the local host which belong to the current user. <br /> The <code>GSPublicNotificationCenterType</code> provides a shared access to a notification center used by processes on the local host belonging to any user. <br /> The <code>GSNetworkNotificationCenterType</code> provides a shared access to a notification center used by processes on the local network. <br /> MacOS-X supports only <code>NSLocalNotificationCenterType</code>. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDistributedNotificationCenter-addObserver$selector$name$object$">addObserver: selector: name: object: </a></h3> - (void) <b>addObserver:</b> (id)anObserver<b> selector:</b> (SEL)aSelector<b> name:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)notificationName<b> object:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)anObject;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Adds an observer to the receiver. Calls <a rel="gsdoc" href="#method$NSDistributedNotificationCenter-addObserver$selector$name$object$suspensionBehavior$">-addObserver:selector:name:object:suspensionBehavior:</a> with <code>NSNotificationSuspensionBehaviorCoalesce</code>. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDistributedNotificationCenter-addObserver$selector$name$object$suspensionBehavior$">addObserver: selector: name: object: suspensionBehavior: </a></h3> - (void) <b>addObserver:</b> (id)anObserver<b> selector:</b> (SEL)aSelector<b> name:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)notificationName<b> object:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)anObject<b> suspensionBehavior:</b> (<a rel="gsdoc" href="TypesAndConstants.html#type$NSNotificationSuspensionBehavior">NSNotificationSuspensionBehavior</a>)suspensionBehavior;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Adds an observer to the receiver. <br /> When a notification matching <var>notificationName</var> and <var>anObject</var> is sent to the center, the object <var>anObserver</var> is sent the message <var>aSelector</var> with the notification info dictionary as its argument. <br /> The <var>suspensionBehavior</var> governs how the center deals with notifications when the process to which the notification should be delivered is suspended: <dl> <dt> <code> NSNotificationSuspensionBehaviorDrop </code> </dt> <dd> Discards the notification if the observing process is suspended. </dd> <dt> <code> NSNotificationSuspensionBehaviorCoalesce </code> </dt> <dd> Discards previously queued notifications when the observing process is suspended, leaving only the last notification posted in the queue. Delivers this single notification when the process becomes unsuspended. </dd> <dt> <code> NSNotificationSuspensionBehaviorHold </code> </dt> <dd> Queues notifications when the observing process is suspended, delivering all the queued notifications when the process becomes unsuspended again. </dd> <dt> <code> NSNotificationSuspensionBehaviorDeliverImmediately </code> </dt> <dd> Deliver the notification immediately, even if the destination process is suspended. </dd> </dl> </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDistributedNotificationCenter-postNotification$">postNotification: </a></h3> - (void) <b>postNotification:</b> (<a rel="gsdoc" href="NSNotification.html#class$NSNotification">NSNotification</a>*)notification;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Posts the <var>notification</var> to the center using postNotificationName:object:userInfo:deliverImmediately: with the delivery flag set to <code>NO</code>. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDistributedNotificationCenter-postNotificationName$object$">postNotificationName: object: </a></h3> - (void) <b>postNotificationName:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)notificationName<b> object:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)anObject;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Posts the <var>notificationName</var> and <var>anObject</var> to the center using postNotificationName:object:userInfo:deliverImmediately: with the user info set to <code>nil</code> and the delivery flag set to <code>NO</code>. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDistributedNotificationCenter-postNotificationName$object$userInfo$">postNotificationName: object: userInfo: </a></h3> - (void) <b>postNotificationName:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)notificationName<b> object:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)anObject<b> userInfo:</b> (<a rel="gsdoc" href="NSDictionary.html#class$NSDictionary">NSDictionary</a>*)userInfo;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Posts the <var>notificationName</var>, <var>anObject</var> and <var>userInfo</var> to the center using postNotificationName:object:userInfo:deliverImmediately: with the delivery flag set to <code>NO</code>. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDistributedNotificationCenter-postNotificationName$object$userInfo$deliverImmediately$">postNotificationName: object: userInfo: deliverImmediately: </a></h3> - (void) <b>postNotificationName:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)notificationName<b> object:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)anObject<b> userInfo:</b> (<a rel="gsdoc" href="NSDictionary.html#class$NSDictionary">NSDictionary</a>*)userInfo<b> deliverImmediately:</b> (BOOL)deliverImmediately;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> The primitive notification posting method... <br /> The <var>userInfo</var> dictionary may contain only property-list objects. <br /> The <var>deliverImmediately</var> flag specifies whether the suspension state of the receiving process is to be ignored. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDistributedNotificationCenter-removeObserver$name$object$">removeObserver: name: object: </a></h3> - (void) <b>removeObserver:</b> (id)anObserver<b> name:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)notificationName<b> object:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)anObject;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Removes the observer from the center. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDistributedNotificationCenter-setSuspended$">setSuspended: </a></h3> - (void) <b>setSuspended:</b> (BOOL)flag;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Sets the suspension state of the receiver... if the receiver is suspended, it won't handle notification until it is unsuspended again, unless the notifications are posted to be delivered immediately. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDistributedNotificationCenter-suspended">suspended </a></h3> - (BOOL) <b>suspended</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Returns the current suspension state of the receiver. </div> <hr width="25%" align="left" /> </div> <a name="_NSDistributedNotificationCenter_ivars"/> <br/><hr width="50%" align="left" /> <h2>Instance Variables for NSDistributedNotificationCenter Class</h2> <h3><a name="ivariable$NSDistributedNotificationCenter*_centerLock">_centerLock</a></h3> @protected NSRecursiveLock* <b>_centerLock</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> <em>Warning</em> the underscore at the start of the name of this instance variable indicates that, even though it is not technically <em>private</em>, it is intended for internal use within the package, and you should not use the variable in other code. </div> <hr width="25%" align="left" /> <h3><a name="ivariable$NSDistributedNotificationCenter*_remote">_remote</a></h3> @protected id <b>_remote</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> <em>Warning</em> the underscore at the start of the name of this instance variable indicates that, even though it is not technically <em>private</em>, it is intended for internal use within the package, and you should not use the variable in other code. </div> <hr width="25%" align="left" /> <h3><a name="ivariable$NSDistributedNotificationCenter*_suspended">_suspended</a></h3> @protected BOOL <b>_suspended</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> <em>Warning</em> the underscore at the start of the name of this instance variable indicates that, even though it is not technically <em>private</em>, it is intended for internal use within the package, and you should not use the variable in other code. </div> <hr width="25%" align="left" /> <h3><a name="ivariable$NSDistributedNotificationCenter*_type">_type</a></h3> @protected NSString* <b>_type</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> <em>Warning</em> the underscore at the start of the name of this instance variable indicates that, even though it is not technically <em>private</em>, it is intended for internal use within the package, and you should not use the variable in other code. </div> <hr width="25%" align="left" /> <br/><hr width="50%" align="left" /><br/> <br /> <a href="Base.html">Up</a> </font> </body> </html>