![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is the below code thread safe, in multithreaded environments will a race condition happen as we are using static Singleton* Singleton::Instance () { static Singleton s; return &s; } Regards, Alamelu |
#3
| |||
| |||
|
|
That particular code segment is thread-safe. However, if you want to actually update the contents of the Singleton class, you need to make sure you write that code in a thread-safe manner. "Alamelu" <Alamelu (AT) discussions (DOT) microsoft.com> wrote in message news:731CBBAD-9656-4810-8137-E696514A7C4A (AT) microsoft (DOT) com... Is the below code thread safe, in multithreaded environments will a race condition happen as we are using static Singleton* Singleton::Instance () { static Singleton s; return &s; } Regards, Alamelu |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |