Skip to content

Commit

Permalink
Add JoinHandle::is_finished method
Browse files Browse the repository at this point in the history
  • Loading branch information
zdimension committed Oct 29, 2024
1 parent 72d24bd commit a46288f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/wasm32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ impl<T> JoinHandle<T> {
pub async fn join_async(self) -> Result<T> {
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<T> fmt::Debug for JoinHandle<T> {
Expand Down

0 comments on commit a46288f

Please sign in to comment.