2013/5/20 Vicente J. Botet Escriba
int main() {
auto worker = spawn(...); // Um... what is the type of 'self'? Is it a valid receiver for the response message? send(worker, ...); receive ( // again: what is 'self' allowed to receive/reply? ... ); }
Couldn't spawn have a template parameter giving the provided protocol? Self could be typed with the supported protocol(s). Self could be passed by the underlying system as a parameter of the spawned function, as e.g. Boost.Coroutine does. This avoids the use of thread specific data to get the current self as I expect you do. Up to the user to manage with the self parameter.
This issue was discussed on the ISO C++ future proposals forum - using thread specific data (thread_local,thread__) would not work if the worker would migrate between the threads (compiler opts issue).