// -*- rust -*- fn main() { let port[int] p = port(); let int i = 10; while (i > 0) { spawn thread child(i); i = i - 1; } log "main thread exiting"; } fn child(int x) { log x; } // -*- rust -*- fn main() { let int i = 10; while (i > 0) { spawn thread "child" child(i); i = i - 1; } log "main thread exiting"; } fn child(int x) { log x; } // xfail-stage0 // -*- rust -*- fn main() { let int i = 10; while (i > 0) { spawn thread "child" child(i); i = i - 1; } log "main thread exiting"; } fn child(int x) { log x; } // xfail-stage0 // xfail-stage1 // xfail-stage2 // -*- rust -*- fn main() { let int i = 10; while (i > 0) { spawn thread "child" child(i); i = i - 1; } log "main thread exiting"; } fn child(int x) { log x; } // xfail-stage0 // xfail-stage1 // xfail-stage2 // xfail-stage3 // -*- rust -*- fn main() { let int i = 10; while (i > 0) { spawn thread "child" child(i); i = i - 1; } log "main thread exiting"; } fn child(int x) { log x; } ./src/test/run-pass/threads.rs:11:17:11:24: error: expecting (, found "child" ./src/test/run-pass/threads.rs:11 spawn thread "child" child(i); ^~~~~~~ rt: --- rt: f00e:main:main: upcall fail 'explicit failure', src/comp/syntax/parse/parser.rs:112 rt: f00e:main: domain main @0x999804c root task failed // xfail-stage0 // xfail-stage1 // xfail-stage2 // xfail-stage3 // -*- rust -*- fn main() { let int i = 10; while (i > 0) { spawn thread "child" child(i); i = i - 1; } log "main thread exiting"; } fn child(int x) { log x; } // xfail-stage1 // xfail-stage2 // xfail-stage3 // -*- rust -*- fn main() { let int i = 10; while (i > 0) { spawn thread "child" child(i); i = i - 1; } log "main thread exiting"; } fn child(int x) { log x; } // -*- rust -*- use std; import std::task; fn main() { let i = 10; while (i > 0) { task::_spawn(bind child(i)); i = i - 1; } log "main thread exiting"; } fn child(x : int) { log x; } // -*- rust -*- use std; import std::task; fn main() { let i = 10; while i > 0 { task::_spawn(bind child(i)); i = i - 1; } log "main thread exiting"; } fn child(x: int) { log x; } // -*- rust -*- use std; import std::task; fn main() { let i = 10; while i > 0 { task::spawn(bind child(i)); i = i - 1; } log "main thread exiting"; } fn child(x: int) { log x; } // -*- rust -*- use std; import std::task; fn main() { let i = 10; while i > 0 { task::spawn2(copy i, child); i = i - 1; } log "main thread exiting"; } fn# child(&&x: int) { log x; } // -*- rust -*- use std; import std::task; fn main() { let i = 10; while i > 0 { task::spawn(copy i, child); i = i - 1; } log "main thread exiting"; } fn# child(&&x: int) { log x; } // -*- rust -*- use std; import std::task; fn main() { let i = 10; while i > 0 { task::spawn(copy i, child); i = i - 1; } log "main thread exiting"; } fn child(&&x: int) { log x; } // -*- rust -*- use std; import task; fn main() { let i = 10; while i > 0 { task::spawn(copy i, child); i = i - 1; } log "main thread exiting"; } fn child(&&x: int) { log x; } // -*- rust -*- use std; import task; fn main() { let i = 10; while i > 0 { task::spawn(copy i, child); i = i - 1; } #debug("main thread exiting"); } fn child(&&x: int) { log_full(core::debug, x); } // -*- rust -*- use std; import task; fn main() { let i = 10; while i > 0 { task::spawn(copy i, child); i = i - 1; } #debug("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- use std; import task; fn main() { let i = 10; while i > 0 { task::spawn {|| child(i); }; i = i - 1; } #debug("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- use std; import task; fn main() { let mut i = 10; while i > 0 { task::spawn {|| child(i); }; i = i - 1; } #debug("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- use std; import task; fn main() { let mut i = 10; while i > 0 { task::spawn {|copy i| child(i); }; i = i - 1; } #debug("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- use std; import task; fn main() { let mut i = 10; while i > 0 { task::spawn({|copy i| child(i); }); i = i - 1; } #debug("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- use std; import task; fn main() { let mut i = 10; while i > 0 { task::spawn(|copy i| child(i) ); i = i - 1; } #debug("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- use std; import task; fn main() { let mut i = 10; while i > 0 { task::spawn(|copy i| child(i) ); i = i - 1; } debug!{"main thread exiting"}; } fn child(&&x: int) { log(debug, x); } // -*- rust -*- use std; import task; fn main() { let mut i = 10; while i > 0 { task::spawn(|copy i| child(i) ); i = i - 1; } debug!("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- use std; fn main() { let mut i = 10; while i > 0 { task::spawn(|copy i| child(i) ); i = i - 1; } debug!("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- extern mod std; fn main() { let mut i = 10; while i > 0 { task::spawn(|copy i| child(i) ); i = i - 1; } debug!("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- // 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. extern mod std; fn main() { let mut i = 10; while i > 0 { task::spawn(|copy i| child(i) ); i = i - 1; } debug!("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- // 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. extern mod std; fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } debug!("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- // 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. extern mod std; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } debug!("main thread exiting"); } fn child(&&x: int) { log(debug, x); } // -*- rust -*- // 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. extern mod std; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } debug!("main thread exiting"); } fn child(&&x: int) { debug!(x); } // -*- rust -*- // 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. extern mod std; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } debug!("main thread exiting"); } fn child(&&x: int) { debug!(x); } // -*- rust -*- // 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. extern mod std; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } debug!("main thread exiting"); } fn child(x: int) { debug!(x); } // -*- rust -*- // 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. extern mod extra; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } debug!("main thread exiting"); } fn child(x: int) { debug!(x); } // -*- rust -*- // 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. extern mod extra; use std::task; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } debug!("main thread exiting"); } fn child(x: int) { debug!(x); } // -*- rust -*- // 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. extern mod extra; use std::task; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } info!("main thread exiting"); } fn child(x: int) { info!(x); } // -*- rust -*- // 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. extern mod extra; use std::task; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } info2!("main thread exiting"); } fn child(x: int) { info2!("{}", x); } // -*- rust -*- // 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. extern mod extra; use std::task; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } info!("main thread exiting"); } fn child(x: int) { info!("{}", x); } // 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. extern mod extra; use std::task; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; || child(i)}); i = i - 1; } info!("main thread exiting"); } fn child(x: int) { info!("{}", x); } // 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. extern mod extra; use std::task; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; proc() child(i)}); i = i - 1; } info!("main thread exiting"); } fn child(x: int) { info!("{}", x); } // 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. extern crate extra; use std::task; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; proc() child(i)}); i = i - 1; } info!("main thread exiting"); } fn child(x: int) { info!("{}", x); } // 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. use std::task; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; proc() child(i)}); i = i - 1; } info!("main thread exiting"); } fn child(x: int) { info!("{}", x); } // 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. use std::task; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; proc() child(i)}); i = i - 1; } println!("main thread exiting"); } fn child(x: int) { println!("{}", x); } // 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. use std::task; pub fn main() { let mut i = 10; while i > 0 { task::spawn({let i = i; move|| child(i)}); i = i - 1; } println!("main thread exiting"); } fn child(x: int) { println!("{}", x); } // 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. use std::thread::Thread; pub fn main() { let mut i = 10; while i > 0 { Thread::spawn({let i = i; move|| child(i)}).detach(); i = i - 1; } println!("main thread exiting"); } fn child(x: int) { println!("{}", x); } // 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. use std::thread::Thread; pub fn main() { let mut i = 10; while i > 0 { Thread::spawn({let i = i; move|| child(i)}); i = i - 1; } println!("main thread exiting"); } fn child(x: int) { println!("{}", x); } // 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. use std::thread::Thread; pub fn main() { let mut i = 10; while i > 0 { Thread::scoped({let i = i; move|| child(i)}); i = i - 1; } println!("main thread exiting"); } fn child(x: int) { println!("{}", x); } // 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. #![feature(std_misc)] use std::thread::Thread; pub fn main() { let mut i = 10; while i > 0 { Thread::scoped({let i = i; move|| child(i)}); i = i - 1; } println!("main thread exiting"); } fn child(x: int) { println!("{}", x); } // 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. #![feature(std_misc)] use std::thread::Thread; pub fn main() { let mut i = 10; while i > 0 { Thread::scoped({let i = i; move|| child(i)}); i = i - 1; } println!("main thread exiting"); } fn child(x: isize) { println!("{}", x); } // 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. #![feature(std_misc)] use std::thread; pub fn main() { let mut i = 10; while i > 0 { thread::scoped({let i = i; move|| child(i)}); i = i - 1; } println!("main thread exiting"); } fn child(x: isize) { println!("{}", x); } // 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. #![feature(std_misc)] use std::thread; pub fn main() { let mut i = 10; while i > 0 { thread::spawn({let i = i; move|| child(i)}).join(); i = i - 1; } println!("main thread exiting"); } fn child(x: isize) { println!("{}", x); }