pub struct ScopedJoinHandle<'scope, T>(JoinInner<'scope, T>);
Expand description
An owned permission to join on a scoped thread (block on its termination).
See Scope::spawn
for details.
Tuple Fields§
§0: JoinInner<'scope, T>
Implementations§
Source§impl<'scope, T> ScopedJoinHandle<'scope, T>
impl<'scope, T> ScopedJoinHandle<'scope, T>
1.63.0 · Sourcepub fn join(self) -> Result<T>
pub fn join(self) -> Result<T>
Waits for the associated thread to finish.
This function will return immediately if the associated thread has already finished.
In terms of atomic memory orderings, the completion of the associated
thread synchronizes with this function returning.
In other words, all operations performed by that thread
happen before
all operations that happen after join
returns.
If the associated thread panics, Err
is returned with the panic payload.
§Examples
1.63.0 · Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Checks if the associated thread has finished running its main function.
is_finished
supports implementing a non-blocking join operation, by checking
is_finished
, and calling join
if it returns true
. This function does not block. To
block while waiting on the thread to finish, use join
.
This might return true
for a brief moment after the thread’s main
function has returned, but before the thread itself has stopped running.
However, once this returns true
, join
can be expected
to return quickly, without blocking for any significant amount of time.
Trait Implementations§
Auto Trait Implementations§
impl<'scope, T> Freeze for ScopedJoinHandle<'scope, T>
impl<'scope, T> !RefUnwindSafe for ScopedJoinHandle<'scope, T>
impl<'scope, T> Send for ScopedJoinHandle<'scope, T>where
T: Send,
impl<'scope, T> Sync for ScopedJoinHandle<'scope, T>where
T: Send,
impl<'scope, T> Unpin for ScopedJoinHandle<'scope, T>
impl<'scope, T> !UnwindSafe for ScopedJoinHandle<'scope, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
sized_type_properties
)[Self]
. Read more