mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-23 15:10:34 +00:00
17 lines
396 B
Rust
17 lines
396 B
Rust
use std::thread;
|
|
|
|
fn main() {
|
|
const NUM_THREADS: usize = 10;
|
|
let mut handles = Vec::with_capacity(NUM_THREADS);
|
|
for id in 0..NUM_THREADS {
|
|
handles.push(thread::spawn(move || {
|
|
println!("Hello from thread {id}");
|
|
}));
|
|
}
|
|
for handle in handles {
|
|
handle.join().expect("worker thread panicked");
|
|
}
|
|
|
|
println!("Hello from main thread");
|
|
}
|