Quantlabs Substack

Quantlabs Substack

Share this post

Quantlabs Substack
Quantlabs Substack
A C++ multi thread safe singleton example with source code has been posted

A C++ multi thread safe singleton example with source code has been posted

C++, multi thread, safe, singleton, example , source code

quantlabs's avatar
quantlabs
Jun 15, 2010
∙ Paid

Share this post

Quantlabs Substack
Quantlabs Substack
A C++ multi thread safe singleton example with source code has been posted
Share

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.

Already a paid subscriber? Sign in
© 2025 QuantLabs.net
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share