LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 30202 - notify_all_at_thread_exit seg faults if run from a raw pthread context.
Summary: notify_all_at_thread_exit seg faults if run from a raw pthread context.
Status: RESOLVED FIXED
Alias: None
Product: libc++
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Eric Fiselier
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-30 15:05 PDT by Ben Craig
Modified: 2016-09-03 03:08 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Craig 2016-08-30 15:05:58 PDT
std::thread's ctor allocates a __thread_struct, and stuffs it in a thread local variable.  std::notify_all_at_thread_exit tries to use that __thread_struct.

If a thread is created with pthread_create instead of std::thread, then the __thread_struct never gets allocated, and std::notify_all_at_thread_exit seg faults.
Comment 1 Eric Fiselier 2016-09-01 16:24:53 PDT
Potential fix up for review as https://reviews.llvm.org/D24159.
Comment 2 Eric Fiselier 2016-09-01 17:01:45 PDT
Potential fix up for review as https://reviews.llvm.org/D24159.
Comment 3 Eric Fiselier 2016-09-03 03:08:45 PDT
r280588.