// This checks that preemption works. io fn starve_main(chan[int] alive) { log "signalling main"; alive <| 1; log "starving main"; let int i = 0; while (true) { i += 1; } } io fn main() { let port[int] alive = port(); log "main started"; let task s = spawn starve_main(chan(alive)); let int i; log "main waiting for alive signal"; i <- alive; log "main got alive signal"; while (i < 1000) { log "main iterated"; i += 1; } log "main completed"; } // This checks that preemption works. io fn starve_main(chan[int] alive) { log "signalling main"; alive <| 1; log "starving main"; let int i = 0; while (true) { i += 1; } } io fn main() { let port[int] alive = port(); log "main started"; let task s = spawn starve_main(chan(alive)); let int i; log "main waiting for alive signal"; i <- alive; log "main got alive signal"; while (i < 50) { log "main iterated"; i += 1; } log "main completed"; } // This checks that preemption works. impure fn starve_main(chan[int] alive) { log "signalling main"; alive <| 1; log "starving main"; let int i = 0; while (true) { i += 1; } } impure fn main() { let port[int] alive = port(); log "main started"; let task s = spawn starve_main(chan(alive)); let int i; log "main waiting for alive signal"; i <- alive; log "main got alive signal"; while (i < 50) { log "main iterated"; i += 1; } log "main completed"; } // xfail-stage0 // This checks that preemption works. impure fn starve_main(chan[int] alive) { log "signalling main"; alive <| 1; log "starving main"; let int i = 0; while (true) { i += 1; } } impure fn main() { let port[int] alive = port(); log "main started"; let task s = spawn starve_main(chan(alive)); let int i; log "main waiting for alive signal"; i <- alive; log "main got alive signal"; while (i < 50) { log "main iterated"; i += 1; } log "main completed"; } // xfail-stage0 // This checks that preemption works. fn starve_main(chan[int] alive) { log "signalling main"; alive <| 1; log "starving main"; let int i = 0; while (true) { i += 1; } } fn main() { let port[int] alive = port(); log "main started"; let task s = spawn starve_main(chan(alive)); let int i; log "main waiting for alive signal"; i <- alive; log "main got alive signal"; while (i < 50) { log "main iterated"; i += 1; } log "main completed"; } // xfail-stage0 // xfail-stage1 // xfail-stage2 // This checks that preemption works. fn starve_main(chan[int] alive) { log "signalling main"; alive <| 1; log "starving main"; let int i = 0; while (true) { i += 1; } } fn main() { let port[int] alive = port(); log "main started"; let task s = spawn starve_main(chan(alive)); let int i; log "main waiting for alive signal"; i <- alive; log "main got alive signal"; while (i < 50) { log "main iterated"; i += 1; } log "main completed"; } // xfail-stage0 // xfail-stage1 // xfail-stage2 // This checks that preemption works. fn starve_main(chan[int] alive) { log "signalling main"; alive <| 1; log "starving main"; let int i = 0; while (true) { i += 1; } } fn main() { let port[int] alive = port(); log "main started"; let task s = spawn starve_main(chan(alive)); let int i; log "main waiting for alive signal"; alive |> i; log "main got alive signal"; while (i < 50) { log "main iterated"; i += 1; } log "main completed"; } // xfail-stage0 // xfail-stage1 // xfail-stage2 // xfail-stage3 // This checks that preemption works. fn starve_main(chan[int] alive) { log "signalling main"; alive <| 1; log "starving main"; let int i = 0; while (true) { i += 1; } } fn main() { let port[int] alive = port(); log "main started"; let task s = spawn starve_main(chan(alive)); let int i; log "main waiting for alive signal"; alive |> i; log "main got alive signal"; while (i < 50) { log "main iterated"; i += 1; } log "main completed"; } // xfail-stage0 // xfail-stage1 // xfail-stage2 // xfail-stage3 // This checks that preemption works. fn starve_main(alive: chan[int]) { log "signalling main"; alive <| 1; log "starving main"; let i: int = 0; while true { i += 1; } } fn main() { let alive: port[int] = port(); log "main started"; let s: task = spawn starve_main(chan(alive)); let i: int; log "main waiting for alive signal"; alive |> i; log "main got alive signal"; while i < 50 { log "main iterated"; i += 1; } log "main completed"; } // xfail-stage1 // xfail-stage2 // xfail-stage3 // This checks that preemption works. fn starve_main(alive: chan[int]) { log "signalling main"; alive <| 1; log "starving main"; let i: int = 0; while true { i += 1; } } fn main() { let alive: port[int] = port(); log "main started"; let s: task = spawn starve_main(chan(alive)); let i: int; log "main waiting for alive signal"; alive |> i; log "main got alive signal"; while i < 50 { log "main iterated"; i += 1; } log "main completed"; } // xfail-stage1 // xfail-stage2 // xfail-stage3 // This checks that preemption works. fn starve_main(alive: chan<int>) { log "signalling main"; alive <| 1; log "starving main"; let i: int = 0; while true { i += 1; } } fn main() { let alive: port<int> = port(); log "main started"; let s: task = spawn starve_main(chan(alive)); let i: int; log "main waiting for alive signal"; alive |> i; log "main got alive signal"; while i < 50 { log "main iterated"; i += 1; } log "main completed"; } // xfail-test // This checks that preemption works. fn starve_main(alive: chan<int>) { log "signalling main"; alive <| 1; log "starving main"; let i: int = 0; while true { i += 1; } } fn main() { let alive: port<int> = port(); log "main started"; let s: task = spawn starve_main(chan(alive)); let i: int; log "main waiting for alive signal"; alive |> i; log "main got alive signal"; while i < 50 { log "main iterated"; i += 1; } log "main completed"; } // xfail-stage1 // xfail-stage2 // xfail-stage3 // This checks that preemption works. fn starve_main(alive: chan<int>) { log "signalling main"; alive <| 1; log "starving main"; let i: int = 0; while true { i += 1; } } fn main() { let alive: port<int> = port(); log "main started"; let s: task = spawn starve_main(chan(alive)); let i: int; log "main waiting for alive signal"; alive |> i; log "main got alive signal"; while i < 50 { log "main iterated"; i += 1; } log "main completed"; } // xfail-test // This checks that preemption works. fn starve_main(alive: chan<int>) { log "signalling main"; alive <| 1; log "starving main"; let i: int = 0; while true { i += 1; } } fn main() { let alive: port<int> = port(); log "main started"; let s: task = spawn starve_main(chan(alive)); let i: int; log "main waiting for alive signal"; alive |> i; log "main got alive signal"; while i < 50 { log "main iterated"; i += 1; } log "main completed"; } // xfail-test // This checks that preemption works. fn starve_main(alive: chan<int>) { #debug("signalling main"); alive <| 1; #debug("starving main"); let i: int = 0; while true { i += 1; } } fn main() { let alive: port<int> = port(); #debug("main started"); let s: task = spawn starve_main(chan(alive)); let i: int; #debug("main waiting for alive signal"); alive |> i; #debug("main got alive signal"); while i < 50 { #debug("main iterated"); i += 1; } #debug("main completed"); } // xfail-test // This checks that preemption works. fn starve_main(alive: chan<int>) { #debug("signalling main"); alive <| 1; #debug("starving main"); let i: int = 0; loop { i += 1; } } fn main() { let alive: port<int> = port(); #debug("main started"); let s: task = spawn starve_main(chan(alive)); let i: int; #debug("main waiting for alive signal"); alive |> i; #debug("main got alive signal"); while i < 50 { #debug("main iterated"); i += 1; } #debug("main completed"); } // xfail-test // This checks that preemption works. fn starve_main(alive: chan<int>) { debug!{"signalling main"}; alive <| 1; debug!{"starving main"}; let i: int = 0; loop { i += 1; } } fn main() { let alive: port<int> = port(); debug!{"main started"}; let s: task = spawn starve_main(chan(alive)); let i: int; debug!{"main waiting for alive signal"}; alive |> i; debug!{"main got alive signal"}; while i < 50 { debug!{"main iterated"}; i += 1; } debug!{"main completed"}; } // xfail-test // This checks that preemption works. fn starve_main(alive: chan<int>) { debug!("signalling main"); alive <| 1; debug!("starving main"); let i: int = 0; loop { i += 1; } } fn main() { let alive: port<int> = port(); debug!("main started"); let s: task = spawn starve_main(chan(alive)); let i: int; debug!("main waiting for alive signal"); alive |> i; debug!("main got alive signal"); while i < 50 { debug!("main iterated"); i += 1; } debug!("main completed"); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test // This checks that preemption works. fn starve_main(alive: chan<int>) { debug!("signalling main"); alive <| 1; debug!("starving main"); let i: int = 0; loop { i += 1; } } fn main() { let alive: port<int> = port(); debug!("main started"); let s: task = spawn starve_main(chan(alive)); let i: int; debug!("main waiting for alive signal"); alive |> i; debug!("main got alive signal"); while i < 50 { debug!("main iterated"); i += 1; } debug!("main completed"); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test // This checks that preemption works. fn starve_main(alive: chan<int>) { debug!("signalling main"); alive <| 1; debug!("starving main"); let i: int = 0; loop { i += 1; } } pub fn main() { let alive: port<int> = port(); debug!("main started"); let s: task = spawn starve_main(chan(alive)); let i: int; debug!("main waiting for alive signal"); alive |> i; debug!("main got alive signal"); while i < 50 { debug!("main iterated"); i += 1; } debug!("main completed"); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test // This checks that preemption works. fn starve_main(alive: chan<int>) { debug!("signalling main"); alive.recv(1); debug!("starving main"); let i: int = 0; loop { i += 1; } } pub fn main() { let alive: port<int> = port(); debug!("main started"); let s: task = do task::spawn { starve_main(chan(alive)); }; let i: int; debug!("main waiting for alive signal"); alive.send(i); debug!("main got alive signal"); while i < 50 { debug!("main iterated"); i += 1; } debug!("main completed"); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test // This checks that preemption works. // note: halfway done porting to modern rust extern mod extra; use std::comm; use extra::comm; fn starve_main(alive: Port<int>) { debug!("signalling main"); alive.recv(); debug!("starving main"); let mut i: int = 0; loop { i += 1; } } pub fn main() { let (port, chan) = stream(); debug!("main started"); do spawn { starve_main(port); }; let mut i: int = 0; debug!("main waiting for alive signal"); chan.send(i); debug!("main got alive signal"); while i < 50 { debug!("main iterated"); i += 1; } debug!("main completed"); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test // This checks that preemption works. // note: halfway done porting to modern rust extern mod extra; use std::comm; use extra::comm; fn starve_main(alive: Port<int>) { info!("signalling main"); alive.recv(); info!("starving main"); let mut i: int = 0; loop { i += 1; } } pub fn main() { let (port, chan) = stream(); info!("main started"); do spawn { starve_main(port); }; let mut i: int = 0; info!("main waiting for alive signal"); chan.send(i); info!("main got alive signal"); while i < 50 { info!("main iterated"); i += 1; } info!("main completed"); } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test // This checks that preemption works. // note: halfway done porting to modern rust extern mod extra; use std::comm; use extra::comm; fn starve_main(alive: Port<int>) { info!("signalling main"); alive.recv(); info!("starving main"); let mut i: int = 0; loop { i += 1; } } pub fn main() { let (port, chan) = stream(); info!("main started"); spawn(proc() { starve_main(port); }); let mut i: int = 0; info!("main waiting for alive signal"); chan.send(i); info!("main got alive signal"); while i < 50 { info!("main iterated"); i += 1; } info!("main completed"); } // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // ignore-test // This checks that preemption works. // note: halfway done porting to modern rust extern mod extra; use std::comm; use extra::comm; fn starve_main(alive: Port<int>) { info!("signalling main"); alive.recv(); info!("starving main"); let mut i: int = 0; loop { i += 1; } } pub fn main() { let (port, chan) = stream(); info!("main started"); spawn(proc() { starve_main(port); }); let mut i: int = 0; info!("main waiting for alive signal"); chan.send(i); info!("main got alive signal"); while i < 50 { info!("main iterated"); i += 1; } info!("main completed"); } // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // ignore-test // This checks that preemption works. // note: halfway done porting to modern rust extern crate extra; use std::comm; use extra::comm; fn starve_main(alive: Port<int>) { info!("signalling main"); alive.recv(); info!("starving main"); let mut i: int = 0; loop { i += 1; } } pub fn main() { let (port, chan) = stream(); info!("main started"); spawn(proc() { starve_main(port); }); let mut i: int = 0; info!("main waiting for alive signal"); chan.send(i); info!("main got alive signal"); while i < 50 { info!("main iterated"); i += 1; } info!("main completed"); } // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // ignore-test // This checks that preemption works. // note: halfway done porting to modern rust extern crate extra; use std::comm; use extra::comm; fn starve_main(alive: Receiver<int>) { info!("signalling main"); alive.recv(); info!("starving main"); let mut i: int = 0; loop { i += 1; } } pub fn main() { let (port, chan) = stream(); info!("main started"); spawn(proc() { starve_main(port); }); let mut i: int = 0; info!("main waiting for alive signal"); chan.send(i); info!("main got alive signal"); while i < 50 { info!("main iterated"); i += 1; } info!("main completed"); } // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // ignore-test // This checks that preemption works. // note: halfway done porting to modern rust use std::comm; fn starve_main(alive: Receiver<int>) { info!("signalling main"); alive.recv(); info!("starving main"); let mut i: int = 0; loop { i += 1; } } pub fn main() { let (port, chan) = stream(); info!("main started"); spawn(proc() { starve_main(port); }); let mut i: int = 0; info!("main waiting for alive signal"); chan.send(i); info!("main got alive signal"); while i < 50 { info!("main iterated"); i += 1; } info!("main completed"); } // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // ignore-test // This checks that preemption works. // note: halfway done porting to modern rust use std::comm; fn starve_main(alive: Receiver<int>) { println!("signalling main"); alive.recv(); println!("starving main"); let mut i: int = 0; loop { i += 1; } } pub fn main() { let (port, chan) = stream(); println!("main started"); spawn(proc() { starve_main(port); }); let mut i: int = 0; println!("main waiting for alive signal"); chan.send(i); println!("main got alive signal"); while i < 50 { println!("main iterated"); i += 1; } println!("main completed"); } // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // ignore-test // This checks that preemption works. // note: halfway done porting to modern rust use std::comm; fn starve_main(alive: Receiver<int>) { println!("signalling main"); alive.recv(); println!("starving main"); let mut i: int = 0; loop { i += 1; } } pub fn main() { let (port, chan) = stream(); println!("main started"); spawn(move|| { starve_main(port); }); let mut i: int = 0; println!("main waiting for alive signal"); chan.send(i); println!("main got alive signal"); while i < 50 { println!("main iterated"); i += 1; } println!("main completed"); } // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // ignore-test // This checks that preemption works. // note: halfway done porting to modern rust use std::comm; fn starve_main(alive: Receiver<isize>) { println!("signalling main"); alive.recv(); println!("starving main"); let mut i: isize = 0; loop { i += 1; } } pub fn main() { let (port, chan) = stream(); println!("main started"); spawn(move|| { starve_main(port); }); let mut i: isize = 0; println!("main waiting for alive signal"); chan.send(i); println!("main got alive signal"); while i < 50 { println!("main iterated"); i += 1; } println!("main completed"); }