on-internet
← Community

What doe the async|deferred default policy of std::async mean?

Stack Overflow ·

The cppreference page for std::async says: template< class F, class... Args > std::future async( F&& f, Args&&... args ) Behaves as if ... called with policy ... std::launch::async | std::launch::deferred Well, IIRC, launch::async means that when I make this call, a new thread will start that runs functor f; and launch:deferred means that the functor and its arguments are stored, and the functor is invoked when you wait on the std::future, with the invocation happening on the waiting thread. These two policies seem to be more contradictory than complementary. So, what exactly does the "bitwise

Comments

Sign in or sign up to comment and upvote.

No comments yet.