Hello,
I began to play around with boost::threads, but I'm kind of stuck with this problem:
I don't understand why this program crashes as soon as the exception is thrown, because I try to catch it within the thread. I thought that it would be possible to work with exceptions as long as the handling happens in the same thread as the throwing ?
#include <boost/thread.hpp>
#include <exception>
using namespace std;
void doWork();
void thrower();
int main( int argc, char** argv ){
boost::thread worker(doWork);
worker.join();
return 0;
}
void doWork(){
try{
thrower();
}
catch( const exception &e ){
//handle exception
}
}
void thrower(){
// program terminates as soon as the exception is thrown
throw exception();
}
Additional information:
*Using MinGW32
*Boost v.1.44
*Linking dynamically against the multithread debug dll Version of the thread lib