WIP: Separate process status from context status.
This commit is contained in:
@@ -29,6 +29,7 @@ pub struct Process {
|
||||
pub info: ProcessInfo,
|
||||
/// Context is being waited on
|
||||
pub waitpid: Arc<WaitMap<WaitpidKey, (ProcessId, usize)>>,
|
||||
pub status: ProcessStatus,
|
||||
/// Threads of process
|
||||
pub threads: Vec<Weak<RwSpinlock<Context>>>,
|
||||
}
|
||||
@@ -69,6 +70,12 @@ impl DerefMut for Process {
|
||||
&mut self.info
|
||||
}
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub enum ProcessStatus {
|
||||
PossiblyRunnable,
|
||||
Stopped(usize),
|
||||
Exited(usize),
|
||||
}
|
||||
|
||||
pub const INIT: ProcessId = ProcessId::new(1);
|
||||
static NEXT_PID: AtomicProcessId = AtomicProcessId::new(INIT);
|
||||
@@ -110,6 +117,7 @@ pub fn new_process(info: impl FnOnce(ProcessId) -> ProcessInfo) -> Result<Arc<Rw
|
||||
let proc = Arc::try_new(RwLock::new(Process {
|
||||
waitpid: Arc::try_new(WaitMap::new()).map_err(|_| Error::new(ENOMEM))?,
|
||||
threads: Vec::new(),
|
||||
status: ProcessStatus::PossiblyRunnable,
|
||||
info: info(pid),
|
||||
}))
|
||||
.map_err(|_| Error::new(ENOMEM))?;
|
||||
|
||||
Reference in New Issue
Block a user