Skip to content

Commit 4eb1a58

Browse files
committed
---
yaml --- r: 23142 b: refs/heads/master c: d2e9d99 h: refs/heads/master v: v3
1 parent 691f05b commit 4eb1a58

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 7634e2911b6cedd7d06bbfd716922c4a750b47ae
2+
refs/heads/master: d2e9d99f819e04d32fe8f87dab9e3b318075cf26
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libcore/pipes.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,16 +530,20 @@ fn sender_terminate<T: send>(p: *packet<T>) {
530530
#[doc(hidden)]
531531
fn receiver_terminate<T: send>(p: *packet<T>) {
532532
let p = unsafe { &*p };
533-
assert p.header.blocked_task.is_null();
534533
match swap_state_rel(p.header.state, terminated) {
535534
empty => {
535+
assert p.header.blocked_task.is_null();
536536
// the sender will clean up
537537
}
538538
blocked => {
539-
// this shouldn't happen.
540-
fail ~"terminating a blocked packet"
539+
let old_task = swap_task(p.header.blocked_task, ptr::null());
540+
if !old_task.is_null() {
541+
rustrt::rust_task_deref(old_task);
542+
assert old_task == rustrt::rust_get_task();
543+
}
541544
}
542545
terminated | full => {
546+
assert p.header.blocked_task.is_null();
543547
// I have to clean up, use drop_glue
544548
}
545549
}

trunk/src/test/run-pass/issue-3176.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import pipes::{select2, selectable};
2+
3+
fn main() {
4+
let (c,p) = pipes::stream();
5+
do task::try {
6+
let (c2,p2) = pipes::stream();
7+
do task::spawn {
8+
p2.recv();
9+
#error["brother fails"];
10+
fail;
11+
}
12+
let (c3,p3) = pipes::stream();
13+
c.send(c3);
14+
c2.send(());
15+
#error["child blocks"];
16+
let (c, p) = pipes::stream();
17+
(p, p3).select();
18+
c.send(());
19+
};
20+
#error["parent tries"];
21+
assert !p.recv().try_send(());
22+
#error("all done!");
23+
}

0 commit comments

Comments
 (0)