Re: C++0x, thread, promise and future

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16 July 2011 15:57, Claudio La Rosa wrote:
>
>
> Jonathan Wakely-4 wrote:
>>
>>
>>
>> Are you sure you get a segfault?  You should get an exception in the
>> myAsyncFun thread, which is not caught so the program calls
>> std::teminate
>>
> Yes, I have a segmentation fault.

Ah, I think maybe that behaviour changed between 4.5 and 4.6

> Jonathan Wakely-4 wrote:
>>
>> You can't use a promise more than once, so your loop will always fail
>> on the second iteration.
>>
>
> Ok!
> Then this is the problem.
> But there is no way to create a promise that always works?

No.  It's one use only.  You could create a new promise and assign it
to the one that's been used, and get a new future from it, but making
that threadsafe would take additional synchronisation.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux