[−][src]Struct ctx_thread::ContextJoinHandle
A handle that can be used to join its context thread.
This struct is created by the Context::spawn
method and the
[ContextJoinHandle::spawn
] method.
Implementations
impl<T, '_> ContextJoinHandle<'_, 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 ctx_thread::scope; scope(|ctx| { let handle1 = ctx.spawn(|_| println!("I'm a happy thread :)")); let handle2 = ctx.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.
Trait Implementations
impl<T, '_> Debug for ContextJoinHandle<'_, T>
[src]
impl<T, '_> JoinHandleExt for ContextJoinHandle<'_, T>
[src]
fn as_pthread_t(&self) -> RawPthread
[src]
fn into_pthread_t(self) -> RawPthread
[src]
impl<T, '_> Send for ContextJoinHandle<'_, T>
[src]
impl<T, '_> Sync for ContextJoinHandle<'_, T>
[src]
Auto Trait Implementations
impl<'scope, T> RefUnwindSafe for ContextJoinHandle<'scope, T>
impl<'scope, T> Unpin for ContextJoinHandle<'scope, T>
impl<'scope, T> UnwindSafe for ContextJoinHandle<'scope, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,