// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
#include <iostream>
#include <thread>
#include <chrono>

using namespace std;
using namespace std::chrono;

#include "SimpleSingleton11.h"
#include "MeyersSingleton11.h"
#include "SynchronizedSingleton11.h"
#include "MemBarrierSingleton11.h"
#include "MemBarrierXSingleton11.h"
#include "CallOnceSingleton11.h"

int main()
{
    cout << "SimpleSingleton11:" << endl;
    this_thread::sleep_for(milliseconds(1000));
    SimpleSingleton11* simp = &SimpleSingleton11::Instance();
    simp->Something();
    cout << "MeyersSingleton11:" << endl;
    this_thread::sleep_for(milliseconds(1000));
    MeyersSingleton11* mey = &MeyersSingleton11::Instance();
    mey->Something();
    cout << "SynchronizedSingleton11:" << endl;
    this_thread::sleep_for(milliseconds(1000));
    SynchronizedSingleton11* sync = &SynchronizedSingleton11::Instance();
    sync->Something();
    cout << "MemBarrierSingleton11:" << endl;
    this_thread::sleep_for(milliseconds(1000));
    MemBarrierSingleton11* bar = &MemBarrierSingleton11::Instance();
    bar->Something();
    cout << "MemBarrierXSingleton11:" << endl;
    this_thread::sleep_for(milliseconds(1000));
    MemBarrierXSingleton11* barx = &MemBarrierXSingleton11::Instance();
    barx->Something();
    cout << "CallOnceSingleton11:" << endl;
    this_thread::sleep_for(milliseconds(1000));
    CallOnceSingleton11* once = &CallOnceSingleton11::Instance();
    once->Something();
    return 0;
}
