Skip to content

Commit a25af32

Browse files
committed
---
yaml --- r: 28392 b: refs/heads/try c: 70e5a19 h: refs/heads/master v: v3
1 parent 5c60f70 commit a25af32

File tree

2 files changed

+49
-20
lines changed

2 files changed

+49
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 63e25946f0ae4e776a853ebd3429d0cd67f437e1
5+
refs/heads/try: 70e5a19ebffb29a124a4b4c5513cf5d654d3634a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/libcore/task.rs

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,9 +1720,16 @@ fn test_spawn_linked_sup_fail_up() { // child fails; parent fails
17201720
// Unidirectional "parenting" shouldn't override bidirectional linked.
17211721
// We have to cheat with opts - the interface doesn't support them because
17221722
// they don't make sense (redundant with task().supervised()).
1723+
let opts = {
1724+
let mut opts = default_task_opts();
1725+
opts.linked = true;
1726+
opts.supervised = true;
1727+
move opts
1728+
};
1729+
17231730
let b0 = task();
17241731
let b1 = TaskBuilder({
1725-
opts: { linked: true, supervised: true,.. b0.opts },
1732+
opts: move opts,
17261733
can_not_copy: None,
17271734
.. *b0
17281735
});
@@ -1733,9 +1740,16 @@ fn test_spawn_linked_sup_fail_up() { // child fails; parent fails
17331740
fn test_spawn_linked_sup_fail_down() { // parent fails; child fails
17341741
// We have to cheat with opts - the interface doesn't support them because
17351742
// they don't make sense (redundant with task().supervised()).
1743+
let opts = {
1744+
let mut opts = default_task_opts();
1745+
opts.linked = true;
1746+
opts.supervised = true;
1747+
move opts
1748+
};
1749+
17361750
let b0 = task();
17371751
let b1 = TaskBuilder({
1738-
opts: { linked: true, supervised: true,.. b0.opts },
1752+
opts: move opts,
17391753
can_not_copy: None,
17401754
.. *b0
17411755
});
@@ -1816,33 +1830,39 @@ fn test_spawn_linked_sup_propagate_sibling() {
18161830

18171831
#[test]
18181832
#[ignore(cfg(windows))]
1819-
fn test_spawn_raw_notify() {
1820-
let task_po = comm::Port();
1821-
let task_ch = comm::Chan(task_po);
1822-
let notify_po = comm::Port();
1823-
let notify_ch = comm::Chan(notify_po);
1833+
fn test_spawn_raw_notify_success() {
1834+
let (task_ch, task_po) = pipes::stream();
1835+
let (notify_ch, notify_po) = pipes::stream();
18241836

18251837
let opts = {
1826-
notify_chan: Some(notify_ch),
1838+
notify_chan: Some(move notify_ch)
18271839
.. default_task_opts()
18281840
};
1829-
do spawn_raw(opts) {
1830-
comm::send(task_ch, get_task());
1841+
do spawn_raw(opts) |move task_ch| {
1842+
task_ch.send(get_task());
18311843
}
1832-
let task_ = comm::recv(task_po);
1833-
assert comm::recv(notify_po) == Exit(task_, Success);
1844+
let task_ = task_po.recv();
1845+
assert notify_po.recv() == Exit(task_, Success);
1846+
}
1847+
1848+
#[test]
1849+
#[ignore(cfg(windows))]
1850+
fn test_spawn_raw_notify_failure() {
1851+
// New bindings for these
1852+
let (task_ch, task_po) = pipes::stream();
1853+
let (notify_ch, notify_po) = pipes::stream();
18341854

18351855
let opts = {
18361856
linked: false,
18371857
notify_chan: Some(notify_ch),
18381858
.. default_task_opts()
18391859
};
18401860
do spawn_raw(opts) {
1841-
comm::send(task_ch, get_task());
1861+
task_ch.send(get_task());
18421862
fail;
18431863
}
1844-
let task_ = comm::recv(task_po);
1845-
assert comm::recv(notify_po) == Exit(task_, Failure);
1864+
let task_ = task_po.recv();
1865+
assert notify_po.recv() == Exit(task_, Failure);
18461866
}
18471867

18481868
#[test]
@@ -2140,8 +2160,13 @@ fn test_unkillable() {
21402160
let po = comm::Port();
21412161
let ch = po.chan();
21422162
2163+
let opts = {
2164+
let mut opts = default_task_opts();
2165+
opts.linked = false;
2166+
move opts
2167+
};
21432168
// We want to do this after failing
2144-
do spawn_raw({ linked: false,.. default_task_opts() }) {
2169+
do spawn_raw(opts) {
21452170
for iter::repeat(10u) { yield() }
21462171
ch.send(());
21472172
}
@@ -2173,11 +2198,15 @@ fn test_unkillable() {
21732198
#[ignore(cfg(windows))]
21742199
#[should_fail]
21752200
fn test_unkillable_nested() {
2176-
let po = comm::Port();
2177-
let ch = po.chan();
2201+
let (ch, po) = pipes::stream();
21782202
21792203
// We want to do this after failing
2180-
do spawn_raw({ linked: false,.. default_task_opts() }) {
2204+
let opts = {
2205+
let mut opts = default_task_opts();
2206+
opts.linked = false;
2207+
move opts
2208+
};
2209+
do spawn_raw(opts) {
21812210
for iter::repeat(10u) { yield() }
21822211
ch.send(());
21832212
}

0 commit comments

Comments
 (0)