The original single-case model no longer meet in a multithreaded environment, then how to do it? ?
answer:
(1) using the Singleton pattern to achieve double-locking thread-safe
(2) static initialization singleton
Examples of direct Singleton object, GetInstance returned directly process _Instance objects
We know that static member is initialized only once, that is to say _Instance first visit the class to instantiate, so Singleton when the class is first accessed, completed Singleton instance of the class, and only be instantiated once in this way, but also to ensure single-mode embodiment of a multithreaded environment
Positive survey: Please note that the figure Singleton's no-argument constructor should be declared as private !!!!!!!!!!!!!!!!!!!!!!