Singleton & Multi-threading
Posted
by ronan
on Stack Overflow
See other posts from Stack Overflow
or by ronan
Published on 2010-06-18T11:40:12Z
Indexed on
2010/06/18
11:43 UTC
Read the original article
Hit count: 296
c++
|multithreading
Friends
I have the following class that
class Singleton
{
private:
static Singleton *p_inst;
Singleton();
public:
static Singleton * instance()
{
if (!p_inst)
{
p_inst = new Singleton();
}
return p_inst;
}
};
Please do elaborate on precautions taken while implementing Singleton in multi-threaded environment ..
Many thanks
© Stack Overflow or respective owner