From 45ed58a81f8f391e20bafd289f62da8b494b8c79 Mon Sep 17 00:00:00 2001 From: Paolo Carlini <paolo.carlini@oracle.com> Date: Thu, 17 Dec 2009 11:09:05 +0000 Subject: [PATCH] re PR libstdc++/42198 ([C++0x] Using std::thread without -pthread causes immediate crash) 2009-12-17 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/42198 * src/thread.cc (thread::_M_start_thread): Throw system_error immediately if the thread system is inactive. From-SVN: r155308 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/src/thread.cc | 3 +++ 2 files changed, 9 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index bf7f50ec99da..05b0c1ec89eb 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2009-12-17 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/42198 + * src/thread.cc (thread::_M_start_thread): Throw system_error + immediately if the thread system is inactive. + 2009-12-16 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/21772 part 2 diff --git a/libstdc++-v3/src/thread.cc b/libstdc++-v3/src/thread.cc index 334e5cb8f1f6..879e864edd4b 100644 --- a/libstdc++-v3/src/thread.cc +++ b/libstdc++-v3/src/thread.cc @@ -83,6 +83,9 @@ namespace std void thread::_M_start_thread(__shared_base_type __b) { + if (!__gthread_active_p()) + __throw_system_error(int(errc::operation_not_permitted)); + __b->_M_this_ptr = __b; int __e = __gthread_create(&_M_id._M_thread, &execute_native_thread_routine, __b.get()); -- GitLab