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

#include <mutex>

using namespace std;

class CallOnceSingleton11
{
private:
    static CallOnceSingleton11* instance;
    mutex mymutex;
    long long counter;
    CallOnceSingleton11() { }
    static once_flag flag;
    static void Init();
public:
    CallOnceSingleton11(const CallOnceSingleton11& original) = delete;
    CallOnceSingleton11& operator=(const CallOnceSingleton11& original) = delete;
    static CallOnceSingleton11& Instance();
    void Reset();
    void Increment();
    long long GetCounter();
};

#endif
