mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-23 19:51:06 +01:00
Add alive method on arbiter
This commit is contained in:
parent
943ddcd37e
commit
4a6322ba34
@ -3,6 +3,7 @@
|
||||
## Unreleased
|
||||
|
||||
- Add `actix_rt::ArbiterBuilder` to allow user to configure the thread spawned for the arbiter.
|
||||
- Add `Arbiter::alive` and `ArbiterHandle::alive` to check is the arbiter is still alive.
|
||||
|
||||
## 2.10.0
|
||||
|
||||
|
@ -71,6 +71,13 @@ impl ArbiterHandle {
|
||||
self.spawn(async { f() })
|
||||
}
|
||||
|
||||
/// Check if the [Arbiter] is still alive.
|
||||
///
|
||||
/// Returns false if the [Arbiter] has been dropped, returns true otherwise.
|
||||
pub fn alive(&self) -> bool {
|
||||
!self.tx.is_closed()
|
||||
}
|
||||
|
||||
/// Instruct [Arbiter] to stop processing it's event loop.
|
||||
///
|
||||
/// Returns true if stop message was sent successfully and false if the [Arbiter] has
|
||||
@ -367,6 +374,13 @@ impl Arbiter {
|
||||
self.spawn(async { f() })
|
||||
}
|
||||
|
||||
/// Check if the [Arbiter] is still alive.
|
||||
///
|
||||
/// Returns false if the [Arbiter] has been dropped, returns true otherwise.
|
||||
pub fn alive(&self) -> bool {
|
||||
!self.tx.is_closed()
|
||||
}
|
||||
|
||||
/// Wait for Arbiter's event loop to complete.
|
||||
///
|
||||
/// Joins the underlying OS thread handle. See [`JoinHandle::join`](thread::JoinHandle::join).
|
||||
|
Loading…
Reference in New Issue
Block a user