From 98fd120ac15948857084821bb3dead9a7f6b65e9 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 21 Jan 2012 15:25:14 -0800 Subject: [PATCH] tutorial: Make the comm examples pass --- doc/tutorial.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/tutorial.md b/doc/tutorial.md index ecafc77ba31..90360b5cc7f 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -2411,7 +2411,6 @@ For example, imagine we wish to perform two expensive computations in parallel. We might write something like: ~~~~ -## xfail-test # fn some_expensive_computation() -> int { 42 } # fn some_other_expensive_computation() {} let port = comm::port::(); @@ -2459,9 +2458,10 @@ some other expensive computation and then waiting for the child's result to arrive on the port: ~~~~ -## xfail-test # fn some_other_expensive_computation() {} # let port = comm::port::(); +# let chan = comm::chan::(port); +# comm::send(chan, 0); some_other_expensive_computation(); let result = comm::recv(port); ~~~~ @@ -2498,9 +2498,12 @@ strified version of the received value, `uint::to_str(value)`. Here is the code for the parent task: ~~~~ -## xfail-test # fn stringifier(from_par: comm::port, -# to_par: comm::chan) {} +# to_par: comm::chan) { +# comm::send(to_par, "22"); +# comm::send(to_par, "23"); +# comm::send(to_par, "0"); +# } fn main() { let t = task::spawn_connected(stringifier); comm::send(t.to_child, 22u);