Open
Description
Add an example:
- a callee that registers a "slow_square" procedure, waiting for a random time [0-5s]
- a caller that issues 5 calls to ^ and waits_for_all 5 calls to return, and prints all 5 results and the sum
The 5 calls should run concurrently (the sum of all 5 results is printed after <=5s) and the caller (and callee) must be single-threaded.
To dispatch a future on the main/current thread:
boost::launch::deferred
see https://github.com/crossbario/autobahn-cpp/blob/master/examples/callee_new.cpp#L92 and eg https://stackoverflow.com/questions/25327256/execute-in-main-thread-with-boostfuturethen
To get the thread id:
boost::this_thread::get_id()
To wait for a set of futures:
boost::wait_for_all(f1, f2, f3, f4, f5);
see https://stackoverflow.com/questions/14170287/future-composability-and-boostwait-for-all