This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]