thread-group 1.0.0

std::thread::ThreadGroup prototype
use std::thread;
use std::time::Duration;
use thread_group::ThreadGroup;

fn main() {
    let group = ThreadGroup::new(|group| {
        group.spawn(|_| {
            thread::sleep(Duration::from_secs(1));
            println!("hello from {:?}", thread::current().id());
        });
        group.spawn(|_| {
            thread::sleep(Duration::from_secs(1));
            println!("hello from {:?}", thread::current().id());
        });
        group.spawn(|_| {
            thread::sleep(Duration::from_secs(1));
            println!("hello from {:?}", thread::current().id());
        });
    });

    group.join().unwrap();
}