aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2009-12-17 11:09:05 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2009-12-17 11:09:05 +0000
commit45ed58a81f8f391e20bafd289f62da8b494b8c79 (patch)
treeee676cacfbbfecabc6570e5b31cd51212b1c1355
parent19c006ff7f5595d57b9021c262450c75583ddad9 (diff)
downloadgcc-45ed58a81f8f391e20bafd289f62da8b494b8c79.zip
gcc-45ed58a81f8f391e20bafd289f62da8b494b8c79.tar.gz
gcc-45ed58a81f8f391e20bafd289f62da8b494b8c79.tar.bz2
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
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/src/thread.cc3
2 files changed, 9 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index bf7f50e..05b0c1e 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 334e5cb..879e864 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());