Actor model & D
Bienlein
jeti789 at web.de
Tue Nov 5 04:28:01 PST 2013
On Monday, 19 August 2013 at 03:11:00 UTC, Luís Marques wrote:
> Can anyone please explain me what it means for the D language
> to follow the Actor model, as the relevant Wikipedia page says
> it does? [1]
>
> [1]
> http://en.wikipedia.org/wiki/Actor_model#Later_Actor_programming_languages
To my understanding "Message Passing Concurrency" in D is already
very actor-like:
void main()
{
Tid worker = spawn(&workerFunc, thisTid);
worker.send(1);
}
void workerFunc(Tid owner)
{
int value = 0;
value = receiveOnly!int();
writeln("value from parent: ", value);
}
Sample code above taken from the book by Ali Çehreli and then
simplified. This is such a breeze compared to spawning a thread
in C++ or Java. Question is what happens when you spawn some
thousand actors. I don't know whether the threads in D are made
for this.
-- Bienlein
More information about the Digitalmars-d
mailing list