Skip to content

Commit 66df38e

Browse files
committed
---
yaml --- r: 29737 b: refs/heads/incoming c: 4808d59 h: refs/heads/master i: 29735: 2d5440e v: v3
1 parent 99539a5 commit 66df38e

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
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 0101125a962abae18525d6014cd26ad10bbb96e6
9+
refs/heads/incoming: 4808d59909b9350fcb557ec7e6f0ce21c505e803
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/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 => {
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)