Procházet zdrojové kódy

Fixed ThreadPool lifecycle to prevent static destruction issues

Paul-Louis Ageneau před 5 roky
rodič
revize
610cd85f9d
1 změnil soubory, kde provedl 3 přidání a 2 odebrání
  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(); }