|
Boost : |
Subject: Re: [boost] [threadpool] new version v12
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2008-11-03 09:34:11
Anthony Williams <anthony.ajw_at_[hidden]> writes:
> "Peter Dimov" <pdimov_at_[hidden]> writes:
>
>> Anthony Williams:
>>> future<T> some_future;
>>>
>>> try
>>> {
>>> throw my_exception();
>>> }catch(...)
>>> {
>>> some_future.wait(); // may invoke task from pool if some_future
>>> // not ready
>>> throw; // oops, where's my exception state gone?
>>> }
>>
>> Are you sure that the above doesn't work?
>>
>> try
>> {
>> throw my_exception();
>> }
>> catch(...)
>> {
>> try
>> {
>> call_function_that_throws();
>> }
>> catch( ... )
>> {
>> }
>>
>> throw; // works
>> }
>
> No, I'm not sure, but if some_future.wait() switches to a new fiber I
> am concerned that it won't, because the exception state is per-thread,
> not per-fiber.
And of course if the thread pool migrates *this* task to another
*thread* inside the wait then I'm fairly sure it won't work with MSVC
unless you're on Vista.
Anthony
-- Anthony Williams Author of C++ Concurrency in Action | http://www.manning.com/williams Custom Software Development | http://www.justsoftwaresolutions.co.uk Just Software Solutions Ltd, Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk