mirror of
https://github.com/fafhrd91/actix-net
synced 2025-06-27 06:09:02 +02:00
actix-rt: Add Arbiter::is_running helper and fix System::is_set doc
`Arbiter::is_running` can be used to check if the current even-loop is currently running; which should also work after the system has stopped. `System::is_set` was updated to reflect what it actually does, it tells if the event loop has started, which alone can't tell if it has stopped. Signed-off-by: Jonathas-Conceicao <jadoliveira@inf.ufpel.edu.br>
This commit is contained in:
committed by
Jonathas Conceição
parent
69e8df9d62
commit
783880bb0a
@ -89,6 +89,11 @@ impl Arbiter {
|
||||
})
|
||||
}
|
||||
|
||||
/// Check if current arbiter is running.
|
||||
pub fn is_running() -> bool {
|
||||
RUNNING.with(|cell| cell.get())
|
||||
}
|
||||
|
||||
/// Stop arbiter from continuing it's event loop.
|
||||
pub fn stop(&self) {
|
||||
let _ = self.sender.unbounded_send(ArbiterCommand::Stop);
|
||||
|
@ -79,7 +79,7 @@ impl System {
|
||||
})
|
||||
}
|
||||
|
||||
/// Check if current system is running.
|
||||
/// Check if current system is set, i.e., as already been started.
|
||||
pub fn is_set() -> bool {
|
||||
CURRENT.with(|cell| cell.borrow().is_some())
|
||||
}
|
||||
|
Reference in New Issue
Block a user