Skip to main content

Practice · 2 of 2

Promise/Future Across Threads

CHALLENGE
Difficulty: advanced+25 XP

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.

Back to lesson: Practice: Threads That Behave