Boost logo

Boost Users :

Subject: Re: [Boost-users] boost threads without exceptions...
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2010-11-03 04:05:55


Dhirendra Pal Singh <s9_rose_at_[hidden]> writes:

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

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net