Skip to content

Commit 4395442

Browse files
authored
Merge pull request #31 from zdimension/zdimension/is-finished
Add JoinHandle::is_finished method
2 parents 72d24bd + a46288f commit 4395442

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/wasm32/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,11 @@ impl<T> JoinHandle<T> {
438438
pub async fn join_async(self) -> Result<T> {
439439
self.0.join_async().await
440440
}
441+
442+
/// Checks if the associated thread has finished running its main function.
443+
pub fn is_finished(&self) -> bool {
444+
Arc::strong_count(&self.0.packet) == 1
445+
}
441446
}
442447

443448
impl<T> fmt::Debug for JoinHandle<T> {

0 commit comments

Comments
 (0)