This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/42198] [C++0x] Using std::thread without -pthread causes immediate crash



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]