re PR libstdc++/52681 ([C++11] Using std::thread without -pthread crashes without...
authorJonathan Wakely <jwakely.gcc@gmail.com>
Sun, 12 Aug 2012 18:57:53 +0000 (18:57 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Sun, 12 Aug 2012 18:57:53 +0000 (19:57 +0100)
PR libstdc++/52681
* src/c++11/thread.cc (thread::_M_start_thread): Improve error text
when threads are not enabled.

From-SVN: r190330

libstdc++-v3/ChangeLog
libstdc++-v3/src/c++11/thread.cc

index f33aef8cdbdabbb1bd90efcde9a8af194225f403..69303abec17fcc70cd223e73be500036fac00dbf 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-12  Jonathan Wakely  <jwakely.gcc@gmail.com>
+
+       PR libstdc++/52681
+       * src/c++11/thread.cc (thread::_M_start_thread): Improve error text
+       when threads are not enabled.
+
 2012-08-09  Jonathan Wakely  <jwakely.gcc@gmail.com>
 
        * acinclude.m4: Update references to final C++11 standard.
index ff034b16143b9a83e806c1372d0ff2c3d1f5e3c6..5c108324141008d3d13b8129c3715463c0f5057d 100644 (file)
@@ -115,7 +115,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   thread::_M_start_thread(__shared_base_type __b)
   {
     if (!__gthread_active_p())
+#if __EXCEPTIONS
+      throw system_error(make_error_code(errc::operation_not_permitted),
+                        "Enable multithreading to use std::thread");
+#else
       __throw_system_error(int(errc::operation_not_permitted));
+#endif
 
     __b->_M_this_ptr = __b;
     int __e = __gthread_create(&_M_id._M_thread,