|
Boost : |
Subject: Re: [boost] [thread] boost::async and launch::deferred - Runtime Error + PATCH
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-03-21 20:17:01
Le 22/03/13 00:17, Fernando Pelliccioni a écrit :
> Hi Vicente, hi all,
>
> The following code snippet throws an exception at runtime
>
> boost::future<int> f1 = boost::async( boost::launch::deferred, []() {
> return 123;
> });
>
> int x= f1.get();//exception thrown
>
> I am using Boost Trunk revision 83512
> I attached a patch, but I'm not sure that's correct, I had no time to
> see the full future.hpp code
The current implementation needs some C++11 features (sorry I have not
had the time to get rid of these features).
Your patch lets me think that either you are not defining
BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK
or BOOST_THREAD_PROVIDES_VARIADIC_THREAD is not defined for your
compiler. Could you confirm?
detail/config.h defines
#if ! defined(BOOST_NO_SFINAE_EXPR) && \
! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
! defined(BOOST_NO_CXX11_DECLTYPE) && \
! defined(BOOST_NO_CXX11_DECLTYPE_N3276) && \
! defined(BOOST_NO_CXX11_AUTO) && \
! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
! defined(BOOST_NO_CXX11_HDR_TUPLE)
#define BOOST_THREAD_PROVIDES_VARIADIC_THREAD
#endif
Please, let me know if this was not clear in the documentation.
>
> I noticed that according to N3558, the future::is_ready() function
> should be called "ready".
> http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3558.pdf
>
> What do you think?
>
I could add it as well as make_ready_future.
Best,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk