March 2002
Intermediate to advanced
496 pages
8h 51m
English
Code that supports SINGLETON ensures that a class has only one instance and provides a global point of access to it. A common way to achieve this is through lazy-initialization of a singleton object, instantiating it only when the singleton is first needed. In a multithreaded environment, you must take care to manage the collaboration of threads that may access a singleton's methods and data at approximately the same time. Regardless of the mechanics that you apply, the value of SINGLETON lies in centralizing authority in a single object.
Read now
Unlock full access