Skip to content

Commit 3446f0d

Browse files
committed
---
yaml --- r: 23137 b: refs/heads/master c: 4808d59 h: refs/heads/master i: 23135: 6cf61e3 v: v3
1 parent 8b2b174 commit 3446f0d

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
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: 0101125a962abae18525d6014cd26ad10bbb96e6
2+
refs/heads/master: 4808d59909b9350fcb557ec7e6f0ce21c505e803
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libcore/pipes.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,23 @@ fn try_recv<T: send, Tbuffer: send>(-p: recv_packet_buffered<T, Tbuffer>)
396396
let p_ = p.unwrap();
397397
let p = unsafe { &*p_ };
398398

399+
struct drop_state {
400+
p: &packet_header;
401+
402+
drop {
403+
if task::failing() {
404+
io::println("failing!");
405+
self.p.state = terminated;
406+
let old_task = swap_task(self.p.blocked_task, ptr::null());
407+
if !old_task.is_null() {
408+
rustrt::rust_task_deref(old_task);
409+
}
410+
}
411+
}
412+
};
413+
414+
let _drop_state = drop_state { p: &p.header };
415+
399416
// optimistic path
400417
match p.header.state {
401418
full => {

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

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

0 commit comments

Comments
 (0)