Преглед на файлове

Fixed ThreadPool lifecycle to prevent static destruction issues

Paul-Louis Ageneau преди 5 години
родител
ревизия
610cd85f9d
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  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(); }