[−][src]Struct crossbeam_utils::thread::ScopedJoinHandle
A handle that can be used to join its scoped thread.
Methods
impl<'scope, T> ScopedJoinHandle<'scope, T>
[src][−]
pub fn join(self) -> Result<T>
[src][−]
Waits for the thread to finish and returns its result.
If the child thread panics, an error is returned.
Panics
This function may panic on some platforms if a thread attempts to join itself or otherwise may create a deadlock with joining threads.
Examples
use crossbeam_utils::thread; thread::scope(|s| { let handle1 = s.spawn(|_| println!("I'm a happy thread :)")); let handle2 = s.spawn(|_| panic!("I'm a sad thread :(")); // Join the first thread and verify that it succeeded. let res = handle1.join(); assert!(res.is_ok()); // Join the second thread and verify that it panicked. let res = handle2.join(); assert!(res.is_err()); }).unwrap();
pub fn thread(&self) -> &Thread
[src][−]
Returns a handle to the underlying thread.
Examples
use crossbeam_utils::thread; thread::scope(|s| { let handle = s.spawn(|_| println!("A child thread is running")); println!("The child thread ID: {:?}", handle.thread().id()); }).unwrap();
Trait Implementations
impl<'scope, T> Sync for ScopedJoinHandle<'scope, T>
[src]
impl<'scope, T> Send for ScopedJoinHandle<'scope, T>
[src]
impl<'scope, T> Debug for ScopedJoinHandle<'scope, T>
[src][+]
Blanket Implementations
impl<T> From for T
[src][−]
impl<T, U> Into for T where
U: From<T>,
[src][−]
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src][−]
T: From<U>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src][−]
impl<T> Borrow for T where
T: ?Sized,
[src][−]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src][−]
T: ?Sized,
ⓘImportant traits for &'a mut Wfn borrow_mut(&mut self) -> &mut T
[src][−]
ⓘImportant traits for &'a mut W
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src][−]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src][−]
impl<T> Any for T where
T: 'static + ?Sized,
[src][−]
T: 'static + ?Sized,