File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 33## Unreleased
44
55- Add ` actix_rt::ArbiterBuilder ` to allow user to configure the thread spawned for the arbiter.
6+ - Add ` Arbiter::alive ` and ` ArbiterHandle::alive ` to check is the arbiter is still alive.
67
78## 2.10.0
89
Original file line number Diff line number Diff line change @@ -71,6 +71,13 @@ impl ArbiterHandle {
7171 self . spawn ( async { f ( ) } )
7272 }
7373
74+ /// Check if the [Arbiter] is still alive.
75+ ///
76+ /// Returns false if the [Arbiter] has been dropped, returns true otherwise.
77+ pub fn alive ( & self ) -> bool {
78+ !self . tx . is_closed ( )
79+ }
80+
7481 /// Instruct [Arbiter] to stop processing it's event loop.
7582 ///
7683 /// Returns true if stop message was sent successfully and false if the [Arbiter] has
@@ -367,6 +374,13 @@ impl Arbiter {
367374 self . spawn ( async { f ( ) } )
368375 }
369376
377+ /// Check if the [Arbiter] is still alive.
378+ ///
379+ /// Returns false if the [Arbiter] has been dropped, returns true otherwise.
380+ pub fn alive ( & self ) -> bool {
381+ !self . tx . is_closed ( )
382+ }
383+
370384 /// Wait for Arbiter's event loop to complete.
371385 ///
372386 /// Joins the underlying OS thread handle. See [`JoinHandle::join`](thread::JoinHandle::join).
You can’t perform that action at this time.
0 commit comments