pub struct ScopedJoinHandle<'scope, T>(JoinInner<'scope, T>);
🔬 This is a nightly-only experimental API. (scoped_threads)
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>
🔬 This is a nightly-only experimental API. (scoped_threads)

Implementations

🔬 This is a nightly-only experimental API. (scoped_threads)

Extracts a handle to the underlying thread.

Examples
#![feature(scoped_threads)]

use std::thread;

thread::scope(|s| {
    let t = s.spawn(|| {
        println!("hello");
    });
    println!("thread id: {:?}", t.thread().id());
});
🔬 This is a nightly-only experimental API. (scoped_threads)

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
#![feature(scoped_threads)]

use std::thread;

thread::scope(|s| {
    let t = s.spawn(|| {
        panic!("oh no");
    });
    assert!(t.join().is_err());
});
🔬 This is a nightly-only experimental API. (scoped_threads)

Checks if the associated thread has finished running its main function.

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.

This function does not block. To block while waiting on the thread to finish, use join.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.