boost threads without exceptions...

Hi Folks, If this question has been asked already, I apologise, but I have to go back to my group and present the answer. So please bear with me. In my current project we are using boost extensively, with exceptions disabled, until last week, when I started using boost threads. I get the following error when compiling... *************** deepsin@deepsin-lnx01:~/code/boost_thread/boost_threads_eg1$ g++ -fno-exceptions -g -I /usr/local/include/boost/ t1.cpp -o t1 -lboost_thread In file included from /usr/local/include/boost/exception_ptr.hpp:9, from /usr/local/include/boost/thread/future.hpp:14, from /usr/local/include/boost/thread.hpp:24, from t1.cpp:3: /usr/local/include/boost/exception/detail/exception_ptr.hpp:17:2: error: #error This header requires exception handling to be enabled. ************** This means that any header file that includes, thread.hpp can't be compiled with -fno-exceptions. I have couple of questions if someone could help me with, I would appreciate. Q1). https://svn.boost.org/trac/boost/ticket/2100, actually says that threads can be compiled without exceptions. Unfortunately its not the case, as I looked at top-of-trunk codebase and the problem still exists. Is this true? I mean threads require exceptions for a fact that is?. If not then can someone help me how to get it to compile without exceptions, and discard the reset of my email please. Q2). If the answer to Q1 is "yes boost threads require exceptions", then was the decision conscious, given a ticked, was opened and closed specifically for this purpose. Q3). Also any idea what is needed to make boost threads work without exception. I mean in terms of man-hours. If my group is okay perhaps I may be willing to work on that change, submit it back to the community, but would need some sort of understanding of the work required and time needed. Any help would be much appreciated.... Thanks in advance... /dev/deep

On Tue, Nov 2, 2010 at 10:06 AM, Dhirendra Pal Singh
Hi Folks, If this question has been asked already, I apologise, but I have to go back to my group and present the answer. So please bear with me.
In my current project we are using boost extensively, with exceptions disabled, until last week, when I started using boost threads. I get the following error when compiling...
*************** deepsin@deepsin-lnx01:~/code/boost_thread/boost_threads_eg1$ g++ -fno-exceptions -g -I /usr/local/include/boost/ t1.cpp -o t1 -lboost_thread In file included from /usr/local/include/boost/exception_ptr.hpp:9, from /usr/local/include/boost/thread/future.hpp:14, from /usr/local/include/boost/thread.hpp:24, from t1.cpp:3: /usr/local/include/boost/exception/detail/exception_ptr.hpp:17:2: error: #error This header requires exception handling to be enabled. **************
This means that any header file that includes, thread.hpp can't be compiled with -fno-exceptions. I have couple of questions if someone could help me with, I would appreciate.
It appears that this is due to a dependency of Boost Thread on Boost Exception's exception_ptr. Somebody should look into this and either remove that dependency or add #ifndef BOOST_NO_EXCEPTIONS around the relevant code (unfortunately I don't have time right now to look into this myself.) Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode

Dhirendra Pal Singh
In my current project we are using boost extensively, with exceptions disabled, until last week, when I started using boost threads. I get the following error when compiling...
*************** deepsin@deepsin-lnx01:~/code/boost_thread/boost_threads_eg1$ g++ -fno-exceptions -g -I /usr/local/include/boost/ t1.cpp -o t1 -lboost_thread In file included from /usr/local/include/boost/exception_ptr.hpp:9, from /usr/local/include/boost/thread/future.hpp:14, from /usr/local/include/boost/thread.hpp:24, from t1.cpp:3: /usr/local/include/boost/exception/detail/exception_ptr.hpp:17:2: error: #error This header requires exception handling to be enabled. **************
This means that any header file that includes, thread.hpp can't be compiled with -fno-exceptions. I have couple of questions if someone could help me with, I would appreciate.
Q1). https://svn.boost.org/trac/boost/ticket/2100, actually says that threads can be compiled without exceptions. Unfortunately its not the case, as I looked at top-of-trunk codebase and the problem still exists. Is this true? I mean threads require exceptions for a fact that is?. If not then can someone help me how to get it to compile without exceptions, and discard the reset of my email please.
Currently, boost::promise and the other classes from boost/thread/future.hpp require boost::exception_ptr, which requires exceptions. The rest of Boost.Thread can be used without exceptions, but you have to use the individual headers (e.g. boost/thread/thread.hpp, boost/thread/mutex.hpp) rather than boost/thread.hpp 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
participants (3)
-
Anthony Williams
-
Dhirendra Pal Singh
-
Emil Dotchevski