• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Notifications vs. messaging
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notifications vs. messaging


  • Subject: Re: Notifications vs. messaging
  • From: Markus Hitter <email@hidden>
  • Date: Mon, 1 Oct 2001 13:01:43 +0200

Am Montag, 1. Oktober 2001 um 00:41 schrieb Brian Hook:

Is there a simple guideline as to when to use a notification vs. when to send a message directly?

sending a method directly:

- much less overhead

- only one object per call

- is executed immediately

- you can get a return value


sending a notification:

- some overhead for queueing

- can be received by several subscribers

- is queued and sent from within the run loop. This makes a difference, for example if you want to open a sheet in -awakeFromNib .


An intermediate between both is to "inject" a method into the run loop:

[[NSRunLoop currentRunLoop] performSelector:@selector(methodToPerform)
target:self argument:nil order:0
modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];

or to use a NSTimer.


Have fun,
Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/


  • Follow-Ups:
    • Re: Notifications vs. messaging
      • From: Nat! <email@hidden>
  • Prev by Date: Re: NSDocument as controller vs. as model
  • Next by Date: Re: How to determine a single pixels alpha?
  • Previous by thread: Re: NSDocument as controller vs. as model
  • Next by thread: Re: Notifications vs. messaging
  • Index(es):
    • Date
    • Thread