Function maidsafe_utilities::thread::named [] [src]

pub fn named<S, F>(thread_name: S, func: F) -> Joiner where
    S: Into<String>,
    F: FnOnce() + Send + 'static, 

This function is intended to be used in all cases where we want to spawn a new thread with a given name and panic if we fail to create the thread.

Examples

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

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