Skip to content

Commit 6f32df1

Browse files
committed
This is strange, but it looks like the 'threads' are not cleaned in the destructor.
1 parent 3d2060b commit 6f32df1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/xrCore/Threading/ThreadPool.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,19 @@ class ThreadPool
5151
setThreadCount(num_threads);
5252
}
5353

54+
void destroy()
55+
{
56+
wait();
57+
threads.clear();
58+
}
59+
5460
// Sets the number of threads to be allocated in this pool
5561
void setThreadCount(const uint32_t count)
5662
{
5763
threads.clear();
64+
threads.reserve(count);
5865
for (auto i = 0; i < count; i++)
59-
threads.push_back(std::make_unique<Thread>());
66+
threads.emplace_back(std::make_unique<Thread>());
6067
}
6168

6269
// Wait until all threads have finished their work items

src/xrCore/xrCore.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ void xrCore::_destroy()
132132
--init_counter;
133133
if (0 == init_counter)
134134
{
135+
ttapi.destroy();
135136
FS._destroy();
136137
EFS._destroy();
137138
xr_delete(xr_FS);

0 commit comments

Comments
 (0)