Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost::thread] interrupt a future get boost::unknown_exception
From: Viatcheslav.Sysoltsev_at_[hidden]
Date: 2011-03-21 12:54:25


On Mon, 21 Mar 2011 17:37:20 +0100, <Viatcheslav.Sysoltsev_at_[hidden]>
wrote:

> On Mon, 21 Mar 2011 02:27:17 +0100, 乔志强
> <qiaozhiqiang_at_[hidden]> wrote:
>
>> It is only boost::thread
>>
>> int foo()
>> {
>> this_thread::sleep(seconds(1000));
>> return 0;
>> }
>>
>>
>> int main(int argc, char** argv)
>> {
>> boost::packaged_task<int> pt(&foo);
>>
>> boost::unique_future<int> fi = pt.get_future();
>> ..........................
>>
>
> The problem is reproducible with gcc 4.4.5 and boost 1.46.1 on ubuntu
> x86 linux. I'd classify the issue as a boost bug and submit it into
> tracker unless somebody from boost::future knowers clarify the situation.
>
> -- Slava
>

Just to clarify what I've got from little debugging session: the user task
is wrapped in try catch(...) clause, so when the future job throws, the
author's idea was likely to save the exception to simulate kind of rethrow
in future.get(). Unfortunately I do not know a mean to save an exception
in general, so seems the author stumbled upon it too, and currently the
exception being thrown in future is lost and general unknown_exception is
reported with get().

-- Slava


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net