A C++ multi thread safe singleton example with source code has been posted
C++, multi thread, safe, singleton, example , source code
Lock.h
//Example from http://www.relisoft.com/Win32/active.html #if !defined _LOCK_H_ #define _LOCK_H_
#include "Mutex.h"
class Lock { public: // Acquire the state of the semaphore Lock ( Mutex & mutex ) : _mutex(mutex) { _mutex.Acquire(); } // Release the state of the semaphore ~Lock () { _mutex.Release(); } private: Mutex & _mutex; };
#endif
Mutex.h
//Examp…
Keep reading with a 7-day free trial
Subscribe to Quantlabs Substack to keep reading this post and get 7 days of free access to the full post archives.