Boost logo

Boost :

Subject: Re: [boost] Is there any interest in a library for actor programming?
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2013-05-20 13:52:44


2013/5/20 Dominik Charousset <dominik.charousset_at_[hidden]>

> >> In any case, we would no longer be able to converts threads to actors
> on-the-fly:
> > Humm, this would be unfortunate.
> >> 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.
>
> The 'self' pointer has to use a thread-local variable, because (1)
> scheduled actors migrate between threads (see Oliver Kowalke's response)
> and (2) threads are converted implicitly as soon as they use actor-related
> messages such as 'send'.
>

What I tried to say - it will not work because compilers are allowed to do
some optimizations with addresses of thread-local data.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk