Created
March 14, 2012 03:48
-
-
Save adam-singer/2033887 to your computer and use it in GitHub Desktop.
Hello world using new dart:isolate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env dart | |
#import('dart:isolate', prefix:'isolate'); | |
isolateCode() { | |
isolate.port.receive((msg, reply) => reply.send("re: $msg")); | |
} | |
void main() { | |
isolate.SendPort sendPort = isolate.spawnFunction(isolateCode); | |
sendPort.call("Hello World").then(print); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It was copied from the post http://goo.gl/p3eAf , kept it in only cause it explicitly shows what is being used from the dart:isolate module. Using it going forward I probably wouldn't prefix. Reasons I might would be naming conflicts or displaying explicit intent.