Closed
Description
I claim the assert at the end here should not trip, yet it does.
fn main() {
let (c,p) = pipes::stream();
do task::try {
let (c2,p2) = pipes::stream();
do task::spawn {
p2.recv();
#error["brother fails"];
fail;
}
let (c3,p3) = pipes::stream();
c.send(c3);
c2.send(());
#error["child blocks"];
p3.recv();
};
#error["parent tries"];
assert !p.recv().try_send(());
}
Output: (note: only the first three lines are nondeterministic)
rust: ~"child blocks"
rust: ~"brother fails"
rust: task failed at 'explicit failure', pipe.rs:8
rust: task failed at 'killed', /home/bblum/rust/src/libcore/pipes.rs:284
rust: ~"parent tries"
rust: task failed at 'Assertion !p.recv().try_send(()) failed', pipe.rs:17
rust: domain main @0xd7eb80 root task failed
This is relevant for mutexes/cvars, exhibited here: https://github.com/mozilla/rust/blob/incoming/src/libcore/sync.rs#L490
I believe the fix should be in fn try_recv
; somewhere in the loop, it should use a flagged destructor.