Singleton: Difference between revisions
Content added Content deleted
Capra Hircus (talk | contribs) No edit summary |
m (→Thread-safe) |
||
Line 611: | Line 611: | ||
{ |
{ |
||
if (myInstance == null) |
if (myInstance == null) |
||
{ |
|||
synchronized(Singleton.class) |
synchronized(Singleton.class) |
||
{ |
|||
if (myInstance == null) |
if (myInstance == null) |
||
{ |
|||
myInstance = new Singleton(); |
myInstance = new Singleton(); |
||
} |
|||
} |
|||
} |
|||
return myInstance; |
return myInstance; |