|
Boost Users : |
Subject: Re: [Boost-users] [boost][thread] Future returning 0xfeeefeee
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-04-07 14:05:14
Le 07/04/13 02:12, Klaim - Joël Lamotte a écrit :
>
> On Sun, Apr 7, 2013 at 1:44 AM, Stefan Strasser
> <strasser_at_[hidden] <mailto:strasser_at_[hidden]>> wrote:
>
> I was under the impression that the promise object itself has to
> be alive when the future result is used. and since you're emptying
> your queue on execution it's not.
> but considering that the promise object could be in another thread
> that was probably a false impression.
>
>
> I have doubts on this too. I think it is more useful for the promise
> and future to share the memory where the result will be set but not
> have a coupled lifetime.
> But I can't confirm yet, I'll have to search in the standard or find a
> language lawyer or someone knowing the SL well.
>
> Anyway, VC's std::promise/future seem to work as I intend in my test...
>
> Which compiler does this even work with yet? Both gcc and clang
> fail. clang on compilation, gcc compiles it but fails at runtime
> with a system_error exception and an invalid error code.
> so you might wanna consider compiler and library bugs, too.
>
>
> I tested only on Visual Studio 2012 Update 2.
> I don't see the problem with gcc/clang, could you provide error reports?
> I don't have access to them.
>
> However, here is a reproduction of the test but with a vector and
> std::future/promise: http://liveworkspace.org/code/2QT6d8$4
> GCC 4.8 accepts it but not clang 3.2 apparently, but I believe it's a
> library implementation problem as the report point to std::chrono code
> that I don't even use directly.
>
> I cant' use Boost.Thread V4 on LiveWorkspace so my tests on these
> compilers are limited.
> Maybe just try http://liveworkspace.org/code/2QT6d8$4 but replace
> std::future and std::promise by boost::promise
> and see if it compiles.
> If it does, just add the WorkQueue code and replace the while loop by
> the call to execute, then you will have the exact code I'm testing.
>
> The queue works itself have some tests that run correctly, so the only
> problem I have is with boost::future/promise in combination with the
> tbb::concurrent_queue.
> As tbb::concurrent_queue don't allow move-only value type, I think
> that's the main difference with the vector, in the use case of my test.
>
> I really need some sleep now. Will get back to it tomorrow.
>
Hi,
I have tested your example on gcc-4.8.0 and clang-3.2 with libc++ and
everything is ok. When I replace std::future/promise by
boost::future/promise everything is ok also.
Maybe, there is a difference between the interface std::vector you use
in this example and your WorkQueue. Could you provide the prototype of
the functions you are using of WorkQueue?
Best,
Vicente
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net