Explorar o código

Fixed ThreadPool lifecycle to prevent static destruction issues

Paul-Louis Ageneau %!s(int64=5) %!d(string=hai) anos
pai
achega
610cd85f9d
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      src/threadpool.cpp

+ 3 - 2
src/threadpool.cpp

@@ -21,8 +21,9 @@
 namespace rtc {
 
 ThreadPool &ThreadPool::Instance() {
-	static ThreadPool instance;
-	return instance;
+	// Init handles joining on cleanup
+	static ThreadPool *instance = new ThreadPool;
+	return *instance;
 }
 
 ThreadPool::~ThreadPool() { join(); }