summaryrefslogtreecommitdiff
path: root/source/Utility/TaskPool.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:50:09 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:50:09 +0000
commitf3fbd1c0586ff6ec7895991e6c28f61a503c36a8 (patch)
tree48d008fd3df8c0e73271a4b18474e0aac6dbfe33 /source/Utility/TaskPool.cpp
parent2fc5d2d1dfaf623ce4e24cd8590565902f8c557c (diff)
Notes
Diffstat (limited to 'source/Utility/TaskPool.cpp')
-rw-r--r--source/Utility/TaskPool.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/Utility/TaskPool.cpp b/source/Utility/TaskPool.cpp
index 75fe59d1e711..c5c63a20cebc 100644
--- a/source/Utility/TaskPool.cpp
+++ b/source/Utility/TaskPool.cpp
@@ -61,8 +61,9 @@ TaskPoolImpl::AddTask(std::function<void()>&& task_fn)
if (m_thread_count < max_threads)
{
m_thread_count++;
- lock.unlock();
-
+ // Note that this detach call needs to happen with the m_tasks_mutex held. This prevents the thread
+ // from exiting prematurely and triggering a linux libc bug
+ // (https://sourceware.org/bugzilla/show_bug.cgi?id=19951).
std::thread (Worker, this).detach();
}
}