浏览代码

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