C++ Language/Std/Multithreading/ReturnValue
Appearance
To return a value from your worker thread, use a std::future<>
return-value-getter object, whose get()
function will block your client thread if the worker thread hasn't yet called set_value()
on a corresponding std::promise<>
return-value-setter object.
Additional information about returning a value from a thread (includes interactive examples)