2011-11-16 18:44:08 -06:00
|
|
|
use std;
|
2011-12-13 18:25:51 -06:00
|
|
|
import int;
|
|
|
|
import comm;
|
|
|
|
import task;
|
2011-11-16 18:44:08 -06:00
|
|
|
|
|
|
|
// We're trying to trigger a race between send and port destruction that
|
|
|
|
// results in the string not being freed
|
|
|
|
|
2011-12-13 18:25:51 -06:00
|
|
|
fn starship(&&ch: comm::chan<str>) {
|
2011-11-16 18:44:08 -06:00
|
|
|
int::range(0, 10) { |_i|
|
|
|
|
comm::send(ch, "pew pew");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn starbase(&&_args: ()) {
|
|
|
|
int::range(0, 10) { |_i|
|
|
|
|
let p = comm::port();
|
|
|
|
task::spawn(comm::chan(p), starship);
|
|
|
|
task::yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
int::range(0, 10) { |_i|
|
|
|
|
task::spawn((), starbase);
|
|
|
|
}
|
|
|
|
}
|