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

#include <iostream>

using namespace std;

class SynchronizedSingleton
{
private:
    static SynchronizedSingleton* instance;
    int SomeState;
    SynchronizedSingleton() { SomeState = 123; }
    SynchronizedSingleton(const SynchronizedSingleton& original) { };
    SynchronizedSingleton& operator=(const SynchronizedSingleton& original) { return *this; };
public:
    static SynchronizedSingleton* Instance();
    void SomeMethod() { cout << SomeState << endl; }
};

#endif
