Re: Singleton instances and multithreading
Re: Singleton instances and multithreading
- Subject: Re: Singleton instances and multithreading
- From: "Axel 'Mikesch' Katerbau" <email@hidden>
- Date: Wed, 11 Jul 2001 19:01:39 GMT
Hi Rob,
Specifically, I want to call the +sharedInstance method on a class I've
developed for an application. Can I do that and then safely message the
returned object without using DO?
In general, no. Typically the singleton class method first checks if
the singleton is already instantiated before instantiating the
singleton if needed. If the check is not known to be thread safe then
you can run in trouble with more than one singleton instance (which is
a bad thing by definition :-) )
Greetings from Cologne,
Axel