diff --git a/src/wasm32/mod.rs b/src/wasm32/mod.rs index 27cf3c6..8bcce7e 100644 --- a/src/wasm32/mod.rs +++ b/src/wasm32/mod.rs @@ -438,6 +438,11 @@ impl JoinHandle { pub async fn join_async(self) -> Result { self.0.join_async().await } + + /// Checks if the associated thread has finished running its main function. + pub fn is_finished(&self) -> bool { + Arc::strong_count(&self.0.packet) == 1 + } } impl fmt::Debug for JoinHandle {