Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2001-06-28 15:38:19

----- Original Message -----
From: <Iain.Hanson_at_[hidden]>
To: <williamkempf_at_[hidden]>
Cc: <boost_at_[hidden]>
Sent: Thursday, June 28, 2001 12:50 PM
Subject: Re: [boost] Re: Boost.Threads - thread_desc concept

> I go for thread alone dies. If the parent does not catch the exception
> then you will abort.

I don't think there's a way to pass an exception from one thread to another.
If the thread exits with an exception, the exception is lost.

> I will be impossible to write reliable systems if
> the whole process dies due to one thread throwing an exception.

No, because the exception can be caught in the thread.

class ExceptionCatcher {
  ExceptionCatcher(boost::function<void> const& f) : func(f) {}
  void operator() const { try { this->func(); } catch (...) {} }
  boost::function<void> func;

// Instead of passing function 'f' to thread constructor,
// pass 'ExceptionCatcher(f)'.

The question is whether this 'ExceptionCatcher' class is used automatically
or not.

Rainer Deyke (root_at_[hidden])
Shareware computer games           - 
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

Boost list run by bdawes at, gregod at, cpdaniel at, john at