Why should I use std::async?

it’s called async, but it got a really “sequential behaviour”, No, if you use the std::launch::async policy then it runs asynchronously in a new thread. If you don’t specify a policy it might run in a new thread. basically in the row where you call the future associated with your async function foo, the program … Read more

Which std::async implementations use thread pools?

Black-Box Test Though “white box” check can be done via inspecting boost, libstdc++ or libc++ sources, or checking documentation like just::thread or MSVC Concurrency Runtime, but I can not deny myself the pleasure of writing C++11 code! I have made black-box test: LIVE DEMO #define BOOST_THREAD_PROVIDES_FUTURE #define BOOST_RESULT_OF_USE_DECLTYPE #include <boost/exception/exception.hpp> #include <boost/range/algorithm.hpp> #include <boost/move/iterator.hpp> #include … Read more

Can I use std::async without waiting for the future limitation?

You can move the future into a global object, so when the local future’s destructor runs it doesn’t have to wait for the asynchronous thread to complete. std::vector<std::future<void>> pending_futures; myResonseType processRequest(args…) { //Do some processing and valuate the address and the message… //Sending the e-mail async auto f = std::async(std::launch::async, sendMail, address, message); // transfer … Read more