summaryrefslogtreecommitdiff
path: root/docs/examples/actors/Input.scala
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2006-10-02 15:31:37 +0000
committerPhilipp Haller <hallerp@gmail.com>2006-10-02 15:31:37 +0000
commit8d3d085f4bc64bfe019e49675e64073e5a73f60a (patch)
tree948bca5d3edef0182762cfd703850405e90b21be /docs/examples/actors/Input.scala
parent6c710d403e147a81eeb739e20aba07ba47c45b70 (diff)
downloadscala-8d3d085f4bc64bfe019e49675e64073e5a73f60a.tar.gz
scala-8d3d085f4bc64bfe019e49675e64073e5a73f60a.tar.bz2
scala-8d3d085f4bc64bfe019e49675e64073e5a73f60a.zip
Clean-ups and new example for usage of input ch...
Clean-ups and new example for usage of input channels.
Diffstat (limited to 'docs/examples/actors/Input.scala')
-rw-r--r--docs/examples/actors/Input.scala19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/examples/actors/Input.scala b/docs/examples/actors/Input.scala
new file mode 100644
index 0000000000..05e3c08958
--- /dev/null
+++ b/docs/examples/actors/Input.scala
@@ -0,0 +1,19 @@
+package examples.actors
+
+import scala.actors.Actor._
+import scala.actors.Channel
+
+object Input extends Application {
+
+ var in = new Channel[Pair[int, int]]
+
+ actor(in) {
+ in.receive {
+ case Pair(x, y) => reply(x + y)
+ }
+ }
+
+ actor {
+ scala.Console.println(in !? Pair(40, 2))
+ }
+}