maidsafe_utilities::thread! [] [src]

macro_rules! thread {
    ($thread_name:expr, $entry_point:expr) => { ... };
}

This macro is intended to be used in all cases where we want to spawn a new thread of execution and if that is not possible then panic out.

Examples

let _ = thread!("DaemonThread", move || {
    std::thread::sleep(std::time::Duration::from_millis(10));
});

let sleep_duration_ms = 500;
let _raii_joiner = maidsafe_utilities::thread
                                     ::RaiiThreadJoiner::new(thread!("ManagedThread", move || {
    std::thread::sleep(std::time::Duration::from_millis(sleep_duration_ms));
}));