Re: [Boost-bugs] [Boost C++ Libraries] #5150: boost::thread does not print or return the error value when creating a thread fails.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5150: boost::thread does not print or return the error value when creating a thread fails.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-05-11 07:04:51


#5150: boost::thread does not print or return the error value when creating a
thread fails.
------------------------------------------+---------------------------------
  Reporter: jukka.jylanki@… | Owner: anthonyw
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.45.0 | Severity: Problem
Resolution: | Keywords:
------------------------------------------+---------------------------------

Comment (by anonymous):

 The problem is that the boost sources don't check for the error value when
 it creates a new thread in thread.cpp and report it back in any way, which
 makes it impossible to debug the reason why a thread creation might fail.

 The thread::start_thread() calls _beginthreadex (which calls CreateThread
 if BOOST_HAS_THREADEX isn't defined). CreateThread has the following
 documentation on MSDN: "If the function fails, the return value is NULL.
 To get extended error information, call GetLastError." _beginthreadex has
 the following documentation on MSDN: "_beginthreadex returns 0 on an
 error, in which case errno and _doserrno are set.".

 It would be more helpful if the the exception
 "boost::throw_exception(thread_resource_error());" would carry the reason
 for the failure, instead of only reporting back "I failed for an unknown
 reason.".

 I tried to manually read GetLastError when this occurred, but it returned
 0, which indicates that the error field was cleared by an operation in
 between.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5150#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC