N
Neil.Fang.CN
Supposing I have a class like this:
class SomeManager
{
public:
static SomeManager& getInstance();
}
SomeManager& SomeManager::getInstance()
{
static SomeManager instance;
return instance;
}
Will the “ static SomeManager instance;” allocated in stack? If so,
this will failed in multi-threads, because every thread have it's own
stack?
Thanks!
--Neil
class SomeManager
{
public:
static SomeManager& getInstance();
}
SomeManager& SomeManager::getInstance()
{
static SomeManager instance;
return instance;
}
Will the “ static SomeManager instance;” allocated in stack? If so,
this will failed in multi-threads, because every thread have it's own
stack?
Thanks!
--Neil