add process and task managers
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good

This commit is contained in:
2026-05-14 17:39:55 +01:00
parent 6694bd2dd1
commit be684ab0f9
32 changed files with 816 additions and 93 deletions
@@ -0,0 +1,42 @@
use crate::process::{ProcessKind, ProcessState};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ProcessId(pub u32);
#[derive(Debug, Clone)]
pub struct Process {
pub id: ProcessId,
pub app_id: u32,
pub title: String,
pub kind: ProcessKind,
pub state: ProcessState,
}
impl Process {
pub fn new(id: ProcessId, app_id: u32, title: impl Into<String>, kind: ProcessKind) -> Self {
Self { id, app_id, title: title.into(), kind, state: ProcessState::Created }
}
pub fn mark_running(&mut self) {
self.state = ProcessState::Running;
}
pub fn mark_suspended(&mut self) {
self.state = ProcessState::Suspended;
}
pub fn mark_stopped(&mut self) {
self.state = ProcessState::Stopped;
}
pub fn mark_crashed(&mut self) {
self.state = ProcessState::Crashed;
}
pub fn is_alive(&self) -> bool {
matches!(
self.state,
ProcessState::Created | ProcessState::Running | ProcessState::Suspended
)
}
}