Select Git revision
Untitled 2.vi
-
Post, Fabian authoredPost, Fabian authored
test.cpp 669 B
#include <thread>
#include "log.h"
static void logThread()
{
static int a = 42;
while(true)
{
Log(Log::INFO)<<"DEBUG"<<' '<<++a;
std::this_thread::sleep_for(std::chrono::microseconds(10));
}
}
static void logThreadTwo()
{
static unsigned int a = 0;
while(true)
{
a+=2;
Log(Log::INFO)<<"DEBUG 2"<<' '<<a;
std::this_thread::sleep_for(std::chrono::microseconds(1));
}
}
int main()
{
Log::level = Log::INFO;
Log(Log::INFO)<<"Starting thread";
std::thread threadA(logThread);
std::thread threadB(logThreadTwo);
while(true)
{
Log(Log::INFO)<<"MAIN"<<" Thread";
std::this_thread::sleep_for(std::chrono::microseconds(1));
}
return 0;
}