• 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: NSNotification vs message callback?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNotification vs message callback?


  • Subject: Re: NSNotification vs message callback?
  • From: "l.m.orchard" <email@hidden>
  • Date: Tue, 7 Aug 2001 10:55:06 -0400

On Tuesday, August 7, 2001, at 01:17 AM, Lloyd Sargent
<email@hidden> wrote:

> Personally, I think what you are doing is the safest. NSConnections
> allow you the ability to do some really cool things that you can't with
> NSNotification. (Like if you set up something that is a server and later
> decide "hey, maybe multiple people want to be able to look at this
> junk"). Cool stuff.
>
> However, the BIGGIE is that NSNotification is not really thread safe per
> se. Which is, of course, TERRIBLY annoying, but there ya go.

Well, just to clarify.. Right now I'm using an NSConnection which
communicates directly to a supplied object via a supplied selector. If I
started using NSNotifications, I'd be using that same NSConnection, only
now I'd be sending messages back to self in the main thread, which would
then send out NSNotifications on the main thread.

So, everything still happens on the main thread, with the difference being
that in the first case, messages are delivered directly, but in the second
case, messages are broadcast out via NSNotifications.

> Personally, I'm of the background that if you can't see a good reason to
> put it in the first cut of code, why burden yourself (and whoever
> maintains it) with stuff you don't need?

Well, it works... but I'm just learning ObjC and Cocoa, so I'm trying to
wrap my head around the idiom and get some good practices down early.

--
Leslie Michael Orchard <email@hidden>
ICQ: 492905 (home) 11082089 (work)
"...see you space cowboy..."


  • Prev by Date: Admin programs and password
  • Next by Date: Re: Autopool question
  • Previous by thread: NSNotification vs message callback?
  • Next by thread: Terminal.app and Opaqueness - HOW?
  • Index(es):
    • Date
    • Thread