소스 검색

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