This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/42198] [C++0x] Using std::thread without -pthread causes immediate crash
- From: "paolo dot carlini at oracle dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Dec 2009 16:01:12 -0000
- Subject: [Bug libstdc++/42198] [C++0x] Using std::thread without -pthread causes immediate crash
- References: <bug-42198-6477@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from paolo dot carlini at oracle dot com 2009-12-16 16:01 -------
For now I would suggest we do something like this and deal with better
solutions as enhancements. What do you think Jon?
Index: thread.cc
===================================================================
--- thread.cc (revision 155290)
+++ thread.cc (working copy)
@@ -83,6 +83,9 @@
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());
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42198