File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 3
3
## Unreleased
4
4
5
5
- 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.
6
7
7
8
## 2.10.0
8
9
Original file line number Diff line number Diff line change @@ -71,6 +71,13 @@ impl ArbiterHandle {
71
71
self . spawn ( async { f ( ) } )
72
72
}
73
73
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
+
74
81
/// Instruct [Arbiter] to stop processing it's event loop.
75
82
///
76
83
/// Returns true if stop message was sent successfully and false if the [Arbiter] has
@@ -367,6 +374,13 @@ impl Arbiter {
367
374
self . spawn ( async { f ( ) } )
368
375
}
369
376
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
+
370
384
/// Wait for Arbiter's event loop to complete.
371
385
///
372
386
/// Joins the underlying OS thread handle. See [`JoinHandle::join`](thread::JoinHandle::join).
You can’t perform that action at this time.
0 commit comments