On one hand, the author says that instanciating the singleton and storing it is not safe because there is no synchronization, but on the other hand he says that null check before is safe because the mutex introduces synchronization.
My understanding would be that the mutex protects this whole section and that the atomic is not necessary at all in this case.
On one hand, the author says that instanciating the singleton and storing it is not safe because there is no synchronization, but on the other hand he says that null check before is safe because the mutex introduces synchronization.
My understanding would be that the mutex protects this whole section and that the atomic is not necessary at all in this case.
Please correct me if I'm wrong.