Struct std::thread::JoinGuardStable
[-] [+]
[src]
#[must_use] pub struct JoinGuard<'a, T: 'a> { // some fields omitted }
An RAII-style guard that will block until thread termination when dropped.
The type T
is the return type for the thread's main function.
Joining on drop is necessary to ensure memory safety when stack data is shared between a parent and child thread.
Due to platform restrictions, it is not possible to Clone
this
handle: the ability to join a child thread is a uniquely-owned
permission.
Methods
impl<'a, T: Send + 'a> JoinGuard<'a, T>
fn thread(&self) -> &Thread
Extract a handle to the thread this guard will join on.
fn join(self) -> T
Wait for the associated thread to finish, returning the result of the thread's calculation.
Panics
Panics on the child thread are propagated by panicking the parent.
impl<T: Send> JoinGuard<'static, T>
fn detach(self)
Detaches the child thread, allowing it to outlive its parent.