std-method

JoinHandle::is_finished: observe completion

Query whether the thread main function has finished without waiting. This is a snapshot, not a result or cancellation request. The fixture deliberately prints no scheduling-dependent status. Expected stdout (not executed): 17 Common mistake: Busy-polling indefinitely instead of joining or using a suitable event mechanism.

Formal Syntax & Structure

rust syntaxrust
handle.is_finished() -> bool

Working Example

Example Snippetrust
fn main() {    let h = std::thread::spawn(|| 17);    let _snapshot = h.is_finished();    println!("{}", h.join().unwrap());}
Rust Reference