C++ Language/Std/Multithreading/ReturnValue

To return a value from your worker thread, use a  return-value-getter object, whose   function will block your client thread if the worker thread hasn't yet called   on a corresponding   return-value-setter object.

Additional information about returning a value from a thread (includes interactive examples)