rmaprath created this revision. rmaprath added a reviewer: EricWF. rmaprath added a subscriber: cfe-commits.
After r271475 [1], I'm seeing a segfault in `join.pass.cpp` on my system. The test calls `std::thread::join()` twice and expects it to throw a system_error. It looks like my pthread implementation does not like being called {{pthread_join}} with the pthread_t argument set to zero, and decides to segfault. There are few easy ways to fix this, I've gone with the approach taken in `std::thread::deatch()` so there's more consistency. [1] http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp?r1=271475&r2=271474&pathrev=271475 http://reviews.llvm.org/D20929 Files: src/thread.cpp Index: src/thread.cpp =================================================================== --- src/thread.cpp +++ src/thread.cpp @@ -46,14 +46,17 @@ void thread::join() { - int ec = __libcpp_thread_join(&__t_); + int ec = EINVAL; + if (__t_ != 0) + { + ec = __libcpp_thread_join(&__t_); + if (ec == 0) + __t_ = 0; + } #ifndef _LIBCPP_NO_EXCEPTIONS if (ec) throw system_error(error_code(ec, system_category()), "thread::join failed"); -#else - (void)ec; #endif // _LIBCPP_NO_EXCEPTIONS - __t_ = 0; } void
Index: src/thread.cpp =================================================================== --- src/thread.cpp +++ src/thread.cpp @@ -46,14 +46,17 @@ void thread::join() { - int ec = __libcpp_thread_join(&__t_); + int ec = EINVAL; + if (__t_ != 0) + { + ec = __libcpp_thread_join(&__t_); + if (ec == 0) + __t_ = 0; + } #ifndef _LIBCPP_NO_EXCEPTIONS if (ec) throw system_error(error_code(ec, system_category()), "thread::join failed"); -#else - (void)ec; #endif // _LIBCPP_NO_EXCEPTIONS - __t_ = 0; } void
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits