File diff r25710:60c9c8536270 → r25711:31eedcf7ade0
src/thread.h
Show inline comments
 
@@ -14,6 +14,7 @@
 
#include "crashlog.h"
 
#include <system_error>
 
#include <thread>
 
#include <mutex>
 

	
 
/**
 
 * Sleep on the current thread for a defined time.
 
@@ -46,7 +47,17 @@ inline bool StartNewThread(std::thread *
 
{
 
#ifndef NO_THREADS
 
	try {
 
		static std::mutex thread_startup_mutex;
 
		std::lock_guard<std::mutex> lock(thread_startup_mutex);
 

	
 
		std::thread t([] (const char *name, TFn&& F, TArgs&&... A) {
 
				/* Delay starting the thread till the main thread is finished
 
				 * with the administration. This prevent race-conditions on
 
				 * startup. */
 
				{
 
					std::lock_guard<std::mutex> lock(thread_startup_mutex);
 
				}
 

	
 
				SetCurrentThreadName(name);
 
				CrashLog::InitThread();
 
				try {