Open oberstet opened 4 years ago
After some digging into boost(!) the exact same functionality as suggested in #203 can be accomplished by defining BOOST_THREAD_PROVIDES_EXECUTORS and use boost::inline_executor as executor on the future continuations. So #203 is totally unnecessary, Well, you live and learn... If that's the way we end up using remains to be seen...
interesting! thanks for dropping this info here.
yeah, these features still seem to be very newish and lacking in docs. historically (when we started autobahnc++), even mere futures in boost were mildly problematic;) things have improved these days ..
anyways, fwiw, besides the boost implementation of executors, there seems to be https://github.com/chriskohlhoff/executors (I haven't used it). but in general, yep, that executors c++23 feature looks promising .. eg all this stuff https://cor3ntin.github.io/posts/executors/
note: executors are not needed to implement the example as described in the issue here
Add an example:
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:
To get the thread id:
To wait for a set of futures: