[thread] Bug sprint: #2100 thread fails to compile with -fno-exceptions

Ticket description: "The thread component fails to compile with GCC when -fno-exceptions is specified. The attached patch allows the libraries / tests shipped with boost 1.35.0 to compile. There didn't seem to be a better option to make g++ happy than to just #ifndef out the catch(...) block, as it would otherwise complain about the throw in the block." from https://svn.boost.org/trac/boost/ticket/2100 Hi, I think that Boost.Thread has not been designed to work without exception. What would be the behavior of the application if we remove just any throw statement? In order to achieve the reporter goal, we should need to add functions returning a return code. IMO this is out of the scope currently. Thus I propose to close the ticket. Anthony, do you agree? Vicente -- View this message in context: http://old.nabble.com/-thread--Bug-sprint%3A--2100-thread-fails-to-compile-w... Sent from the Boost - Dev mailing list archive at Nabble.com.

Vicente Botet Escriba <vicente.botet@wanadoo.fr> writes:
Ticket description: "The thread component fails to compile with GCC when -fno-exceptions is specified. The attached patch allows the libraries / tests shipped with boost 1.35.0 to compile. There didn't seem to be a better option to make g++ happy than to just #ifndef out the catch(...) block, as it would otherwise complain about the throw in the block." from https://svn.boost.org/trac/boost/ticket/2100
Hi, I think that Boost.Thread has not been designed to work without exception. What would be the behavior of the application if we remove just any throw statement? In order to achieve the reporter goal, we should need to add functions returning a return code. IMO this is out of the scope currently. Thus I propose to close the ticket.
I've committed a change to trunk that uses boost::throw_exception in most cases. The only cases I haven't touched are where thread_interrupted is thrown at a cancellation point. As you say, Boost.Thread has not been designed to work without exceptions. In most cases this is not a problem, but interruption relies on exceptions to work properly. I'm therefore inclined to think that interruption should not be available with exceptions disabled, in which case this code can be masked with a #ifdef What do you think? Anthony -- Author of C++ Concurrency in Action | http://www.stdthread.co.uk/book/ just::thread C++0x thread library | http://www.stdthread.co.uk Just Software Solutions Ltd | http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

Bugzilla from anthony.ajw@gmail.com wrote:
Vicente Botet Escriba <vicente.botet@wanadoo.fr> writes:
Ticket description: "The thread component fails to compile with GCC when -fno-exceptions is specified. The attached patch allows the libraries / tests shipped with boost 1.35.0 to compile. There didn't seem to be a better option to make g++ happy than to just #ifndef out the catch(...) block, as it would otherwise complain about the throw in the block." from https://svn.boost.org/trac/boost/ticket/2100
Hi, I think that Boost.Thread has not been designed to work without exception. What would be the behavior of the application if we remove just any throw statement? In order to achieve the reporter goal, we should need to add functions returning a return code. IMO this is out of the scope currently. Thus I propose to close the ticket.
I've committed a change to trunk that uses boost::throw_exception in most cases. The only cases I haven't touched are where thread_interrupted is thrown at a cancellation point.
As you say, Boost.Thread has not been designed to work without exceptions. In most cases this is not a problem, but interruption relies on exceptions to work properly. I'm therefore inclined to think that interruption should not be available with exceptions disabled, in which case this code can be masked with a #ifdef
What do you think?
Hi, the use of boost::throw_exception is welcome but more for the ability this function provides to store a pointer to an exception than the ability to disable exception. If in addition you use some ifdefs to mask features that are not easy to provide without exceptions the reporter of the ticket could use Boost.Thread on an environment that has or requires no exceptions. I don't understand however how an application can work without taking care of errors. Just my point of view. Thanks, Vicente -- View this message in context: http://old.nabble.com/-thread--Bug-sprint%3A--2100-thread-fails-to-compile-w... Sent from the Boost - Dev mailing list archive at Nabble.com.

Vicente Botet Escriba <vicente.botet@wanadoo.fr> writes:
the use of boost::throw_exception is welcome but more for the ability this function provides to store a pointer to an exception than the ability to disable exception. If in addition you use some ifdefs to mask features that are not easy to provide without exceptions the reporter of the ticket could use Boost.Thread on an environment that has or requires no exceptions.
Thanks.
I don't understand however how an application can work without taking care of errors. Just my point of view.
I agree. I understand that the expected practice in such cases is to abort the program where an exception would be thrown. It is then up to the library user to ensure that the circumstances that would lead to an exception don't occur. Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

Anthony Williams wrote:
Vicente Botet Escriba <vicente.botet@wanadoo.fr> writes:
the use of boost::throw_exception is welcome but more for the ability this function provides to store a pointer to an exception than the ability to disable exception. If in addition you use some ifdefs to mask features that are not easy to provide without exceptions the reporter of the ticket could use Boost.Thread on an environment that has or requires no exceptions.
Thanks.
Perhaps, Boost.Thread could provide a callback for thread interruption, like throw_exception does. The user could release the resources associated with the thread and then call something like pthread_kill(pthread_self()). Just a thought.
participants (3)
-
Andrey Semashev
-
Anthony Williams
-
Vicente Botet Escriba