summaryrefslogtreecommitdiff
path: root/src/platform/mod.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-21 00:29:45 +0300
committerGitHub <noreply@github.com>2026-09-21 00:29:45 +0300
commit0ff0f27e222633c97ba4291f6b9be4137002ca84 (patch)
tree97ee77c8a85801ab90133492ddd71b3ce635b8fb /src/platform/mod.rs
parentf090ce95d05d2e7811869be93f9a23bf4ac2c3af (diff)
fix: preserve session layouts across shutdown and restore failures (#4400)
* fix: preserve session layouts across shutdown and restore failures refs #4320 * test: update subscription fixture for pane restore errors --------- Co-authored-by: JJ Liebig <jonathan.liebig@gmail.com>
Diffstat (limited to 'src/platform/mod.rs')
-rw-r--r--src/platform/mod.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/platform/mod.rs b/src/platform/mod.rs
index 2ba3e6f3..488c5bee 100644
--- a/src/platform/mod.rs
+++ b/src/platform/mod.rs
@@ -3,6 +3,36 @@
//! Centralizes OS-dependent behavior behind a clean boundary so core
//! modules don't scatter `#[cfg]` branches through product logic.
+pub(crate) struct HostShutdownMonitor {
+ task: Option<tokio::task::JoinHandle<()>>,
+}
+
+impl HostShutdownMonitor {
+ pub(crate) fn start(
+ requested: std::sync::Arc<std::sync::atomic::AtomicBool>,
+ wake: impl Fn() + Send + Sync + 'static,
+ ) -> Self {
+ let task = monitor_host_shutdown(requested, wake);
+ Self { task }
+ }
+}
+
+impl Drop for HostShutdownMonitor {
+ fn drop(&mut self) {
+ if let Some(task) = self.task.take() {
+ task.abort();
+ }
+ }
+}
+
+#[cfg(not(target_os = "linux"))]
+fn monitor_host_shutdown(
+ _requested: std::sync::Arc<std::sync::atomic::AtomicBool>,
+ _wake: impl Fn() + Send + Sync + 'static,
+) -> Option<tokio::task::JoinHandle<()>> {
+ None
+}
+
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ForegroundProcess {
pub pid: u32,