The Receiver Is responsible for comunication with the receiving thread.
- Storing the return value.
- Synchronisation
- Notifying if the receiving thread is waiting.
- Handle cancelation.
The SharedState does contain all data used to execute the task.
- Store the function and the Receiver.
The Future (the receiving thread) does only need a pointer to the receiver.
The PackagedTask (the executing therad) needs a pointer to the whole SharedState since it needs to know which function to execute and how to save the result.
The Function is not restricted to std::function anymore. Move only function become possible (see test).