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.
Potential fix up for review as https://reviews.llvm.org/D24159.
r280588.