use many_cpus::SystemHardware;
use new_zealand::nz;
fn main() {
let hw = SystemHardware::current();
let selected_processors = hw
.processors()
.to_builder()
.same_memory_region()
.performance_processors_only()
.take(nz!(2))
.unwrap_or_else(|| hw.processors());
let threads = selected_processors.spawn_threads(|processor| {
println!("Spawned thread on processor {}", processor.id());
});
for thread in threads {
thread.join().unwrap();
}
println!("All threads have finished.");
}