Boost logo

Boost :

Subject: Re: [boost] future<>::then() Error returning future<void> (on trunk)
From: Fernando Pelliccioni (fpelliccioni_at_[hidden])
Date: 2013-04-07 17:41:50


On Mon, Apr 1, 2013 at 2:09 PM, Vicente J. Botet Escriba <
vicente.botet_at_[hidden]> wrote:

> Le 22/01/13 22:56, Vicente Botet a écrit :
>
> Fernando Pelliccioni wrote
>>
>>> Hi Vicente, hi all,
>>>
>>> I noticed that in the trunk there is a implementation of
>>> future<>::then().
>>> Thank you very much for your efforts to implement it!
>>>
>> Hi Fernando,
>>
>> I have started with a restricted implementation. While trying to cover
>> with
>> the whole requirements I didn't reach to get correct implementation. This
>> is
>> way this new feature is not delivered yet. For the time been I don't think
>> the current implementation is ready for production code.
>>
>>
>> The following example, compiles OK
>>>
>>> boost::future
>>> <int>
>>> f1 = boost::async([]() { return 123; });
>>> f1.then([](boost::future
>>> <int>
>>> const& f) {
>>> return std::string("");
>>> });
>>>
>>>
>>> But this one fails to compile:
>>> boost::future
>>> <int>
>>> f1 = boost::async([]() { return 123; });
>>> f1.then([](boost::future
>>> <int>
>>> const& f) {
>>> });
>>>
>>> Here future<>::then() have to returns future
>>> <void>
>>> like ...
>>>
>>> boost::async([]() { });
>>>
>>> Am I right?
>>>
>> Yes, it should. I have no access to my development environment for this
>> week. Could you post the compiler error?
>>
>>
>> On the other hand, have you taken into account the following paper?
>>> http://www.open-std.org/jtc1/**sc22/wg21/docs/papers/2012/**
>>> n3451.pdf<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3451.pdf>
>>>
>> I read it and the mail exchanges related to this paper.
>> Currently I didn't reached to make it working at all when the future
>> destructor blocks, but I'm not sure this is the hidden problem as I have
>> also other issues when the future destructor doesn't blocks.
>>
>> I'm really sorry that the current state is not really usable :(
>>
>> Hi Fernando,
>
> I have reworked the future::then function, and even if it is not yet
> complete (e.g. deferred is not implemented for c++98 compilers) it start to
> be usable for c++11 compilers, even if BOOST_THREAD_DONT_PROVIDE_**FUTURE_INVALID_AFTER_GET
> is not defined. BTW, joining on the async future destructor works also.
>
> Please could you give it a try and let me know whatever you can find that
> doesn't works as you expect,
>
> Best,
> Vicente
>
>
>
Hi Vicente,

Sorry for the delay!

It works fine !!

Thanks!

Regards,
Fernando.

>
> ______________________________**_________________
> Unsubscribe & other changes: http://lists.boost.org/**
> mailman/listinfo.cgi/boost<http://lists.boost.org/mailman/listinfo.cgi/boost>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk