Click here to Skip to main content
15,885,914 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why this is not failing in VC6 Pin
NiceNaidu30-May-06 23:55
NiceNaidu30-May-06 23:55 
GeneralRe: Why this is not failing in VC6 Pin
Sameer_Thakur31-May-06 0:04
Sameer_Thakur31-May-06 0:04 
GeneralRe: Why this is not failing in VC6 Pin
BadKarma31-May-06 0:05
BadKarma31-May-06 0:05 
AnswerRe: Why this is not failing in VC6 Pin
Sarath C30-May-06 23:57
Sarath C30-May-06 23:57 
GeneralRe: Why this is not failing in VC6 Pin
NiceNaidu31-May-06 0:01
NiceNaidu31-May-06 0:01 
AnswerRe: Why this is not failing in VC6 Pin
Sarath C31-May-06 0:02
Sarath C31-May-06 0:02 
AnswerRe: Why this is not failing in VC6 Pin
Michael Dunn31-May-06 2:06
sitebuilderMichael Dunn31-May-06 2:06 
QuestionWhy "new" operator is "thread_safe" ? Pin
Ajax9530-May-06 23:17
Ajax9530-May-06 23:17 
I'm currently reading some articals about Singleton.
It mentioned the following data structure is for single thread only
Class Singleton
{
public:
static Singleton * GetInstance()
{
static Singleton instance;
return &instance;
}
protected:
Singleton();
~Singleton();
}
Instead of using local static variable; using new operator to create an object will be thread-safe.
Class Singleton
{
private:
Singleton * m_pInstance;
public:
static Singleton * GetInstance()
{
if (! m_pInstance)
m_pInstance = new Singleton();
return m_pInstance;
}
protected:
Singleton();
~Singleton();
}

I can't see the real difference between these two implementation. Why the one with new operator is thread-safe?

Thanks
AnswerRe: Why "new" operator is "thread_safe" ? Pin
BadKarma30-May-06 23:40
BadKarma30-May-06 23:40 
AnswerRe: Why "new" operator is "thread_safe" ? Pin
Nemanja Trifunovic31-May-06 1:28
Nemanja Trifunovic31-May-06 1:28 
QuestionC++ and ADO problem Pin
antonaras30-May-06 22:58
antonaras30-May-06 22:58 
AnswerRe: C++ and ADO problem Pin
NiceNaidu30-May-06 23:05
NiceNaidu30-May-06 23:05 
GeneralRe: C++ and ADO problem Pin
antonaras30-May-06 23:09
antonaras30-May-06 23:09 
GeneralRe: C++ and ADO problem Pin
antonaras31-May-06 0:04
antonaras31-May-06 0:04 
GeneralRe: C++ and ADO problem Pin
NiceNaidu31-May-06 0:12
NiceNaidu31-May-06 0:12 
AnswerRe: C++ and ADO problem Pin
echozeng31-May-06 5:24
echozeng31-May-06 5:24 
QuestionSet Windows login authentication option programmatically Pin
QuickDeveloper30-May-06 22:20
QuickDeveloper30-May-06 22:20 
AnswerRe: Set Windows login authentication option programmatically Pin
Ștefan-Mihai MOGA30-May-06 22:43
professionalȘtefan-Mihai MOGA30-May-06 22:43 
AnswerRe: Set Windows login authentication option programmatically [modified] Pin
_anil_30-May-06 22:44
_anil_30-May-06 22:44 
GeneralRe: Set Windows login authentication option programmatically [modified] Pin
narayanagvs30-May-06 23:30
narayanagvs30-May-06 23:30 
GeneralRe: Set Windows login authentication option programmatically [modified] Pin
_anil_30-May-06 23:44
_anil_30-May-06 23:44 
GeneralRe: Set Windows login authentication option programmatically [modified] Pin
narayanagvs31-May-06 0:26
narayanagvs31-May-06 0:26 
GeneralRe: Set Windows login authentication option programmatically [modified] Pin
_anil_31-May-06 1:06
_anil_31-May-06 1:06 
GeneralRe: Set Windows login authentication option programmatically [modified] Pin
narayanagvs31-May-06 2:34
narayanagvs31-May-06 2:34 
QuestionTime Pin
Try30-May-06 22:11
Try30-May-06 22:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.