mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-25 13:24:22 +00:00
Add JoinHandle::is_running.
This commit is contained in:
parent
58899c4d9c
commit
d718b1a795
@ -1402,6 +1402,15 @@ impl<T> JoinHandle<T> {
|
||||
pub fn join(mut self) -> Result<T> {
|
||||
self.0.join()
|
||||
}
|
||||
|
||||
/// Checks if the the associated thread is still running its main function.
|
||||
///
|
||||
/// This might return `false` for a brief moment after the thread's main
|
||||
/// function has returned, but before the thread itself has stopped running.
|
||||
#[unstable(feature = "thread_is_running", issue = "none")]
|
||||
pub fn is_running(&self) -> bool {
|
||||
Arc::strong_count(&self.0.packet.0) > 1
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> AsInner<imp::Thread> for JoinHandle<T> {
|
||||
|
Loading…
Reference in New Issue
Block a user