- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Closed
Labels
A-concurrencyArea: ConcurrencyArea: Concurrency
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.
Metadata
Metadata
Assignees
Labels
A-concurrencyArea: ConcurrencyArea: Concurrency