R
Ronen Yacov
Hi everybody,
When declaring a singleton, we write:
static CMySingle::instance()
{
static CMySingle instance;
return instance;
}
Why should there be a problem in a multithreaded enviroment?
If one thread creates a static object the other threads will have the
same
instance (becuase its static).
And if there is a problem, how the docuble check locking solves it?
When declaring a singleton, we write:
static CMySingle::instance()
{
static CMySingle instance;
return instance;
}
Why should there be a problem in a multithreaded enviroment?
If one thread creates a static object the other threads will have the
same
instance (becuase its static).
And if there is a problem, how the docuble check locking solves it?