
On Mon, 21 Mar 2011 17:37:20 +0100,
On Mon, 21 Mar 2011 02:27:17 +0100, 乔志强
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