fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

10K
active users

The C++11 std::async is a simple tool for launching asynchronous tasks to either start a task in parallel or to defer execution on the same thread.

The benefit of std::async is simplicity, as std::async directly returns a std::future; however, we pay for that simplicity with a lack of control.

Compiler Explorer link: compiler-explorer.com/z/x3Kaq9

Paiusco :fosstodon: :linux:

@simontoth Never used/seen std::async with the deferred option. Usually see ppl using RAII in classes for it. But it does sound interesting... Have you seen the deferred being used that way?

@paiusco Yes. While I do prefer RAII or std::unique_ptr with a custom deleted, it is an option.