Skip to content
Snippets Groups Projects
Select Git revision
  • d9ac2cd05f98d0eafa2650d25be153f464c009f7
  • main default protected
  • feature/VA-100_Modbus_RTU
  • develop
  • stepperControl
5 results

Untitled 2.vi

Blame
  • 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;
    }