Lecture 7 - Channels & Packaged Tasks Flashcards
1
Q
What is the name of the channel between an async task and a future?
A
a promise
2
Q
Can we obtain the future from a promise?
A
YEs
3
Q
What do we need to do with a promise?
A
Assign it to a task, it has to be owned
4
Q
What do promises help us do?
A
Synchronise tasks, as we can wait from a promise to get future. We can explicitly write a value back to calling thread
5
Q
What is std::packaged_task
A
Wrapping a task for future execution, it can be treated as first class.
6
Q
How is a std::packaged_task started?
A
Assigning the task to a thread and joining to current thread.