Do std::async and std::future use mutexes and a condition variable under the hood?

Viewed 472

I've been lead to believe that using std::async with the returned future is basically just a simplified way of using mutexes, where the actual handling of the new std::thread and the locking/unlocking of the mutex is abstracted away by the async function and the future.

I'm fairly new to multi-threading concepts - is this the case? Am I understanding something incorrectly?

Edit: I left out that this abstraction would obviously make use of an std::condition_variable

1 Answers

Maybe.

It's up to the implementer. They can do it with std::mutex and std::condition_variable, or with the underlying components with which they implemented those, or with some other scheme.

The standard prescribes the observable behaviour, not the implementation.

Related