/* Collection of code snippets by Arne Vajhøj */
/* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) */
#ifndef DOUBLELOCK_SINGLETON_11_H
#define DOUBLELOCK_SINGLETON_11_H

#include <iostream>

using namespace std;

// **** double lock singleton pattern is not thread safe - never use it ****
class DoubleLockSingleton11
{
private:
    static DoubleLockSingleton11* instance;
    int SomeState;
    DoubleLockSingleton11() { SomeState = 123; }
public:
    DoubleLockSingleton11(const DoubleLockSingleton11& original) = delete;
    DoubleLockSingleton11& operator=(const DoubleLockSingleton11& original) = delete;
    static DoubleLockSingleton11& Instance();
    void SomeMethod() { cout << SomeState << endl; }
};

#endif
