executors / futures

A proposal for a futures programming model for ISO C++
22 stars 7 forks source link

Allow `get_executor` to throw #82

Closed brycelelbach closed 6 years ago

brycelelbach commented 6 years ago

We should allow get_executor to throw, as the future may be stored in a shared state that has to be accessed via a synchronization primitive.

E.g. Imagine I have a traditional shared state future, and I stick the executor in my shared state, which is protected by a mutex and condition variable. One of those primitives could throw random OS exceptions, depending on the platform.

The executor presumably needs to be stored in the shared state as the promise needs access to it as well. The possibility of stateful executors would keep you from just making copies of the executor, and giving one to the future and one to the promise.