diff --git a/src/xrCore/Threading/ThreadPool.hpp b/src/xrCore/Threading/ThreadPool.hpp index 889d1b78b78..d0766e85b9a 100644 --- a/src/xrCore/Threading/ThreadPool.hpp +++ b/src/xrCore/Threading/ThreadPool.hpp @@ -51,12 +51,19 @@ class ThreadPool setThreadCount(num_threads); } + void destroy() + { + wait(); + threads.clear(); + } + // Sets the number of threads to be allocated in this pool void setThreadCount(const uint32_t count) { threads.clear(); + threads.reserve(count); for (auto i = 0; i < count; i++) - threads.push_back(std::make_unique()); + threads.emplace_back(std::make_unique()); } // Wait until all threads have finished their work items diff --git a/src/xrCore/xrCore.cpp b/src/xrCore/xrCore.cpp index 614b7c1134e..57ff85fafe0 100644 --- a/src/xrCore/xrCore.cpp +++ b/src/xrCore/xrCore.cpp @@ -132,6 +132,7 @@ void xrCore::_destroy() --init_counter; if (0 == init_counter) { + ttapi.destroy(); FS._destroy(); EFS._destroy(); xr_delete(xr_FS);