- this is thread number 32741
- this is thread number 32742
- this is thread number 32743
- this is thread number 32744
- this is thread number 32745
- this is thread number 32746
- thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 11, message: "Resource temporarily unavailable" } }', src/libcore/result.rs:746
- note: Run with `RUST_BACKTRACE=1` for a backtrace.
- code:
- use std::thread;
- static NTHREADS: i32 = 100000;
- // This is the `main` thread
- fn main() {
- // Make a vector to hold the children which are spawned.
- let mut children = vec![];
- for i in 0..NTHREADS {
- // Spin up another thread
- children.push(thread::spawn(move || {
- println!("this is thread number {}", i)
- }));
- }
- for child in children {
- // Wait for the thread to finish. Returns a result.
- let _ = child.join();
- }
- }
- Rust: DISQUALIFIED.