@@ -424,7 +424,7 @@ there is no way to "catch" the exception.
424424All tasks are, by default, _ linked_ to each other. That means that the fates
425425of all tasks are intertwined: if one fails, so do all the others.
426426
427- ~~~
427+ ~~~ {.xfail-test .linked-failure}
428428# use std::task::spawn;
429429# use std::task;
430430# fn do_some_work() { loop { task::yield() } }
@@ -447,7 +447,7 @@ pattern-match on a result to check whether it's an `Ok` result with an `int`
447447field (representing a successful result) or an ` Err ` result (representing
448448termination with an error).
449449
450- ~~~
450+ ~~~ {.xfail-test .linked-failure}
451451# use std::task;
452452# fn some_condition() -> bool { false }
453453# fn calculate_result() -> int { 0 }
@@ -490,9 +490,10 @@ proceed). Hence, you will need different _linked failure modes_.
490490By default, task failure is _ bidirectionally linked_ , which means that if
491491either task fails, it kills the other one.
492492
493- ~~~
493+ ~~~ {.xfail-test .linked-failure}
494494# use std::task;
495- # fn sleep_forever() { loop { task::yield() } }
495+ # use std::comm::oneshot;
496+ # fn sleep_forever() { loop { let (p, c) = oneshot::<()>(); p.recv(); } }
496497# do task::try {
497498do spawn {
498499 do spawn {
@@ -511,11 +512,12 @@ function `task::try`, which we saw previously, uses `spawn_supervised`
511512internally, with additional logic to wait for the child task to finish
512513before returning. Hence:
513514
514- ~~~
515+ ~~~ {.xfail-test .linked-failure}
515516# use std::comm::{stream, Chan, Port};
517+ # use std::comm::oneshot;
516518# use std::task::{spawn, try};
517519# use std::task;
518- # fn sleep_forever() { loop { task::yield() } }
520+ # fn sleep_forever() { loop { let (p, c) = oneshot::<()>(); p.recv(); } }
519521# do task::try {
520522let (receiver, sender): (Port<int>, Chan<int>) = stream();
521523do spawn { // Bidirectionally linked
@@ -541,9 +543,10 @@ also fail.
541543Supervised task failure propagates across multiple generations even if
542544an intermediate generation has already exited:
543545
544- ~~~
546+ ~~~ {.xfail-test .linked-failure}
545547# use std::task;
546- # fn sleep_forever() { loop { task::yield() } }
548+ # use std::comm::oneshot;
549+ # fn sleep_forever() { loop { let (p, c) = oneshot::<()>(); p.recv(); } }
547550# fn wait_for_a_while() { for _ in range(0, 1000u) { task::yield() } }
548551# do task::try::<int> {
549552do task::spawn_supervised {
@@ -560,7 +563,7 @@ fail!(); // Will kill grandchild even if child has already exited
560563Finally, tasks can be configured to not propagate failure to each
561564other at all, using ` task::spawn_unlinked ` for _ isolated failure_ .
562565
563- ~~~
566+ ~~~ {.xfail-test .linked-failure}
564567# use std::task;
565568# fn random() -> uint { 100 }
566569# fn sleep_for(i: uint) { for _ in range(0, i) { task::yield() } }
@@ -588,7 +591,7 @@ that repeatedly receives a `uint` message, converts it to a string, and sends
588591the string in response. The child terminates when it receives ` 0 ` .
589592Here is the function that implements the child task:
590593
591- ~~~~
594+ ~~~ {.xfail-test .linked-failure}
592595# use extra::comm::DuplexStream;
593596# use std::uint;
594597fn stringifier(channel: &DuplexStream<~str, uint>) {
@@ -611,7 +614,7 @@ response itself is simply the stringified version of the received value,
611614
612615Here is the code for the parent task:
613616
614- ~~~~
617+ ~~~{.xfail-test .linked-failure}
615618# use std::task::spawn;
616619# use std::uint;
617620# use extra::comm::DuplexStream;
0 commit comments