[PATCH] D13748: [libcxx] Fix PR15638 - Only allocate in parent when starting a thread to prevent calling terminate.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 14 15:20:31 PDT 2015
EricWF created this revision.
EricWF added reviewers: mclow.lists, danalbert, jroelofs.
EricWF added a subscriber: cfe-commits.
Hi,
When creating a new thread libc++ performs at least 2 allocations. The first allocates a tuple of args and the functor that will be passed to the new thread. The second allocation is for the thread local storage needed internally by libc++. Currently the second allocation happens in the child thread, meaning that if it throws the program will terminate with an uncaught bad alloc.
The solution to this is to allocate ALL memory in the parent thread and then pass it to the child.
See https://llvm.org/bugs/show_bug.cgi?id=15638
http://reviews.llvm.org/D13748
Files:
include/thread
test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13748.37399.patch
Type: text/x-patch
Size: 6487 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151014/6bc736c4/attachment.bin>
More information about the cfe-commits
mailing list