[Lldb-commits] [PATCH] D19153: Work around a linux libc bug causing a crash in TaskPool
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 15 03:00:48 PDT 2016
labath created this revision.
labath added a reviewer: tberghammer.
labath added a subscriber: lldb-commits.
Doing a pthread_detach while the thread is exiting can cause crashes or other mischief, so we
make sure the thread stays around long enough. The performance impact of the added
synchronization should be minimal, as the parent thread is already holding a mutex, so I am just
making sure it holds it for a little while longer. It's possible the new thread will block on
this mutex immediately after startup, but it should be unblocked really quickly and some
blocking is unavoidable if we actually want to have this synchronization.
@@ -61,8 +61,9 @@
if (m_thread_count < max_threads)
+ // 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();
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 587 bytes
Desc: not available
More information about the lldb-commits