Lecture 7 - Asynchronous Tasks Flashcards
1
Q
What is std::async?
A
Creates an asynchronous task (higher level than threads) to complete alongside current thread.
2
Q
What type is std::async?
A
std::future<>, this is a value that is to be evaluated in the future
3
Q
What is a future handle?
A
represents a value to be computed
4
Q
How to get the value of future?
A
_.get()
5
Q
What happens if value of async task is not ready and we call .ge()?
A
We are blocked until ready
6
Q
Is future first class?
A
yes
7
Q
Is having too many threads bad?
A
Could be yes, as the time it takes to start x amount of threads can outweight the time of execution