• 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: Multiple singletons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple singletons


  • Subject: Re: Multiple singletons
  • From: Daniel Jalkut <email@hidden>
  • Date: Mon, 27 Jun 2005 12:55:30 -0700

Unless you go out of your way to make your singletons cross-process, then they will be restricted to the address space of the application that is hosting them.

One thing worth noting with regard to singletons: always use a "static global" for the singleton variable, and/or name the variable uniquely for each singleton class. I recently ran into a mysterious error which turned out to be due to my carelessly defining two singleton classes, each with a "gSharedInstance" global. Imagine my surprise when the wrong singleton was returned!

Daniel

On Jun 27, 2005, at 12:17 PM, Ken Tozier wrote:

I'm designing a singleton class that could potentially be useful in other applications and was wondering, is the scope of a singleton system-wide, or only within whichever app(s) that use it? Or put another way, can a singleton class be used in an application without stomping on another instance of the same singleton in another app?

Thanks

Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
sweater.com


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Multiple singletons
      • From: Ondra Cada <email@hidden>
References: 
 >Multiple singletons (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: Multiple singletons
  • Next by Date: Re: Funny crash in on Tiger
  • Previous by thread: Re: Multiple singletons
  • Next by thread: Re: Multiple singletons
  • Index(es):
    • Date
    • Thread