Boost logo

Boost :

Subject: [boost] [thread] boost::future::then
From: Vladimir Prus (vladimir.prus_at_[hidden])
Date: 2015-10-09 03:43:27


looking through docs for some other futures implementation [1], I see this:

        Why not use boost::future? #

        At the time of writing, 1.53 (the first version with the requisite features) was brand new, not well-tested,
        and not available to [...] developers.
        It is still a bit buggy/bleeding-edge
        They haven't fleshed out the threading model very well yet, e.g. every single then currently spawns a new
        thread unless you explicitly ask it to work on this thread only, and executor support was nonexistent
        (and now, is still experimental).

Now, 1.53 is ancient. Can anybody comment on these statements regarding boost::future::thread state in 1.59?

In particular, suppose I have this:

        // Thread 1

        boost::promise<int> pi;
        boost::future<int> fi = pi.get_future();

        // pass pi to thread 2 somehow


        // Thread 2


And I want continuation to be executed in thread 1, assuming that thread 1 runs Qt event loop,
allowing me to use QTimer::singleShot, or queued signal, or similar mechanism. How would I go
about making boost::future do it? Has anybody done so?




Boost list run by bdawes at, gregod at, cpdaniel at, john at