-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Description
Depending on number of threads and steal results this test case may livelock, and probably exhaust memory:
fn periodical(n: int) -> Port<bool> {
let (port, chan) = stream();
do spawn {
println(fmt!("periodical %d - begin", n));
loop {
for _ in range(1, n) {
println(fmt!("periodical %d - sending...", n));
chan.send(false);
println(fmt!("periodical %d - sent", n));
}
chan.send(true);
}
}
return port;
}
fn integers() -> Port<int> {
let (port, chan) = stream();
do spawn {
println("integers - begin");
let mut i = 1;
loop {
chan.send(i);
i = i + 1;
}
}
return port;
}
fn main() {
let ints = integers();
let threes = periodical(3);
let fives = periodical(5);
for _ in range(1, 100) {
match (ints.recv(), threes.recv(), fives.recv()) {
(_, true, true) => println("FizzBuzz"),
(_, true, false) => println("Fizz"),
(_, false, true) => println("Buzz"),
(i, false, false) => println(fmt!("%d", i))
}
}
}
Metadata
Metadata
Assignees
Labels
E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.