Skip to content

Instantly share code, notes, and snippets.

@zeroows
Created June 16, 2015 17:08
Show Gist options
  • Save zeroows/813be187066d9faea7a2 to your computer and use it in GitHub Desktop.
Save zeroows/813be187066d9faea7a2 to your computer and use it in GitHub Desktop.
very Simple Actor in D language
import std.stdio, std.concurrency;
void myActor() {
try {
for(;;){
receive(
(int i){ writeln("Received integer: ",i); }
);
}
}catch(Exception e){
// cleanup
}
}
void main() {
auto actor = spawn(&myActor);
foreach(i;0..10) actor.send(i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment