Struct origin_studio::std::thread::JoinHandle
source · pub struct JoinHandle(_);
Implementations§
source§impl JoinHandle
impl JoinHandle
sourcepub fn join(self) -> Result<()>
pub fn join(self) -> Result<()>
Examples found in repository?
examples/rust-by-example-threads.rs (line 23)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() {
// Make a vector to hold the children which are spawned.
let mut children = vec![];
for i in 0..NTHREADS {
// Spin up another thread
children.push(thread::spawn(move || {
println!("this is thread number {}", i);
}));
}
for child in children {
// Wait for the thread to finish. Returns a result.
let _ = child.join();
}
}
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for JoinHandle
impl !Send for JoinHandle
impl !Sync for JoinHandle
impl Unpin for JoinHandle
impl !UnwindSafe for JoinHandle
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
Mutably borrows from an owned value. Read more