Advance Red Bear runtime services and tools
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
use zbus::Connection;
|
||||
|
||||
use crate::runtime_state::SharedRuntime;
|
||||
|
||||
#[cfg(target_os = "redox")]
|
||||
const KSTOP_PATH: &str = "/scheme/kernel.acpi/kstop";
|
||||
|
||||
@@ -13,10 +15,13 @@ fn wait_for_shutdown_edge() -> std::io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn watch_and_emit(connection: Connection) {
|
||||
pub async fn watch_and_emit(connection: Connection, runtime: SharedRuntime) {
|
||||
#[cfg(target_os = "redox")]
|
||||
match tokio::task::spawn_blocking(wait_for_shutdown_edge).await {
|
||||
Ok(Ok(())) => {
|
||||
if let Ok(mut state) = runtime.write() {
|
||||
state.preparing_for_shutdown = true;
|
||||
}
|
||||
let _ = connection
|
||||
.emit_signal(
|
||||
None::<&str>,
|
||||
@@ -38,5 +43,6 @@ pub async fn watch_and_emit(connection: Connection) {
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
{
|
||||
let _ = connection;
|
||||
let _ = runtime;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user