Skip to content

Commit 4028a09

Browse files
committed
Yield after send
1 parent 172df2e commit 4028a09

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/rt/rust_builtin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ chan_id_send(rust_task *task, type_desc *t, rust_task_id target_task_id,
551551
port->remote_chan->send(sptr);
552552
}
553553
target_task->deref();
554+
task->yield();
554555
}
555556
}
556557

src/test/run-pass/send-iloop.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// FIXME #937
2+
// xfail-fast
3+
use std;
4+
import std::task;
5+
import std::comm;
6+
import std::uint;
7+
8+
fn die() {
9+
fail;
10+
}
11+
12+
fn iloop() {
13+
task::unsupervise();
14+
let f = die;
15+
task::spawn(f);
16+
let p = comm::port::<()>();
17+
let c = comm::chan(p);
18+
while true {
19+
comm::send(c, ());
20+
}
21+
}
22+
23+
fn main() {
24+
for each i in uint::range(0u, 16u) {
25+
let f = iloop;
26+
task::spawn(f);
27+
}
28+
}

0 commit comments

Comments
 (0)