Boost logo

Boost :

Subject: Re: [boost] [thread] Exception propagation for thread::join
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-05-18 19:47:58


I'm not sure I understood your concerns.There are a threader/joiner classes in the Boost.Async library that should already offer this functionality. As Anthony said, not only it transfer the exception when joining it but also the returned value when succeeeds. It uses the Future library from Anthony and is based on the design of Kevlin Henney.

You can get it from the vault. I'd appreciate any comments.


----- Original Message -----
From: "Anthony Williams" <anthony.ajw_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, May 18, 2009 12:10 PM
Subject: Re: [boost] [thread] Exception propagation for thread::join

> Emil Dotchevski <emil_at_[hidden]> writes:
>> When joining a thread, in case the thread has exited, I find it
>> convenient to have any exception the thread function throws propagated
>> to the caller of join(). Just as an illustration of what I'm talking
>> about, below is my Win32 implementation of a similar interface. An
>> interesting design decision is what to do if a detached thread throws
>> an exception. Note the line marked with (1) -- I've decided to assert
>> in this case (instead of ignoring the exception, which would be the
>> alternative behavior.)
>> Would something similar be a good addition to Boost Thread?
> No. You can easily write code that does this using a wrapper, as you
> have shown for the win32 API. The futures and packaged_task stuff that I
> will be merging with boost.thread soon will provide such a wrapper that
> also allows return values from thread functions.
> This provides people with a choice --- have the exception terminate the
> program (and allow a debugger to catch it) which is the default, or
> allow the exception to propagate by using a packaged_task+future.
> Anthony
> --
> Author of C++ Concurrency in Action |
> just::thread C++0x thread library |
> Just Software Solutions Ltd |
> 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
> _______________________________________________
> Unsubscribe & other changes:

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