Skip to main content

Practice ยท 2 of 2

Promise/Future Across Threads

Implement runWithResult(std::function<int()>): run the callable on a fresh std::thread, deliver its result through a promise/future, join the thread, and return the result.

Difficulty: advanced

Back to lesson: Practice: Threads That Behave