We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 58899c4 commit d718b1aCopy full SHA for d718b1a
library/std/src/thread/mod.rs
@@ -1402,6 +1402,15 @@ impl<T> JoinHandle<T> {
1402
pub fn join(mut self) -> Result<T> {
1403
self.0.join()
1404
}
1405
+
1406
+ /// Checks if the the associated thread is still running its main function.
1407
+ ///
1408
+ /// This might return `false` for a brief moment after the thread's main
1409
+ /// function has returned, but before the thread itself has stopped running.
1410
+ #[unstable(feature = "thread_is_running", issue = "none")]
1411
+ pub fn is_running(&self) -> bool {
1412
+ Arc::strong_count(&self.0.packet.0) > 1
1413
+ }
1414
1415
1416
impl<T> AsInner<imp::Thread> for JoinHandle<T> {
0 commit comments