std-type
Thread: metadata and wakeup handle
Thread is a lightweight handle for thread identity, names and unpark. It is not a join handle. Obtain one from the current thread or an existing join handle. Expected stdout (not executed): true Common mistake: Using a Thread handle as if it could join the worker.
Formal Syntax & Structure
rust syntaxrust
thread::current() -> Thread; JoinHandle::thread() -> &ThreadWorking Example
Example Snippetrust
fn main() { let main_id = std::thread::current().id(); let worker = std::thread::spawn(move || std::thread::current().id() != main_id); println!("{}", worker.join().unwrap());}