
Jeff Garland wrote:
On Sun, 08 Feb 2004 11:23:37 -0500, David Abrahams wrote
Christopher Currie <christopher@currie.com> writes:
Slawomir Lisznianski wrote:
Are there any plans to support handling of exceptions thrown during joinable thread execution? I recall Usenet discussions with proposals varying from Futures to throwable join(): try { thread.join(); } catch (std::runtime_error& e) { ... } Any ideas?
Doesn't this require a certain amount of compiler support?
Yes.
Why? Corba throws user exceptions across remote procedure calls without changes to the c++ compiler (of course there is an IDL compiler). Also, Rogue Wave has a portable library that does this for threading.
I think I agree with Jeff. Although without compiler support library code cannot propagate arbitrary exceptions across threads, we could manage to propagate exceptions declared ahead of time, possibly when thread object is created. Something along the lines of: boost::thread<runtime_error, ...> my_thread(functor); ...and later: try { my_thread.join() } catch (runtime_error&) { } catch (<any exception declared in type list above>&) { } I'm more uncertain how to approach the problem of (multiple) exceptions thrown in threads that are part of the single group.
IIRC, some compilers don't support throwing exceptions across thread boundaries...
I wouldn't expect compilers to do so. The needed support would have to come entirely from the library. Slawomir Lisznianski; [ www.rhapsodia.org ]