Skip to content
Snippets Groups Projects
Select Git revision
  • 504d8b7ab87a953809d20b79659eb1f0aa2d8f5c
  • 5.4 default protected
  • dev/5.4
  • dev/5.3_downgrade
  • dev/5.5
  • 5.3 protected
  • feature/present_barrier
7 results

RWTHVRClusterUtilities.cpp

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