mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-15 05:06:53 +00:00
abstract async shutdown waiting loop
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
1 parent
0a9b6c136f
commit
9eb99f8070
2 files changed
+13
-8
No files matched your search
+11
-1
@@ -1,5 +1,8 @@
|
||||
use std::{
|
||||
sync::atomic::{AtomicBool, Ordering},
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
},
|
||||
time::SystemTime,
|
||||
};
|
||||
|
||||
@@ -102,6 +105,13 @@ impl Server {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub async fn until_shutdown(self: Arc<Self>) {
|
||||
while self.running() {
|
||||
self.signal.subscribe().recv().await.ok();
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn runtime(&self) -> &runtime::Handle {
|
||||
self.runtime
|
||||
|
||||
Reference in new issue
Block a user