Skip to content

Commit

Permalink
This is strange, but it looks like the 'threads' are not cleaned in t…
Browse files Browse the repository at this point in the history
…he destructor.
  • Loading branch information
intorr committed Feb 13, 2018
1 parent 3d2060b commit 6f32df1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/xrCore/Threading/ThreadPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Thread>());
threads.emplace_back(std::make_unique<Thread>());
}

// Wait until all threads have finished their work items
Expand Down
1 change: 1 addition & 0 deletions src/xrCore/xrCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ void xrCore::_destroy()
--init_counter;
if (0 == init_counter)
{
ttapi.destroy();
FS._destroy();
EFS._destroy();
xr_delete(xr_FS);
Expand Down

0 comments on commit 6f32df1

Please sign in to comment.