1
0
forked from Rativel/BurritOS

Add new thread exception (untested)

This commit is contained in:
Quentin Legot
2023-04-11 17:47:36 +02:00
parent 6c19f66d62
commit a36e470ea1
5 changed files with 56 additions and 8 deletions

View File

@@ -1,3 +1,5 @@
use std::{rc::Rc, cell::RefCell};
use super::{process::Process, system::ObjectType};
use crate::{simulator::machine::{NUM_INT_REGS, NUM_FP_REGS, STACK_REG}};
@@ -22,7 +24,7 @@ pub struct ThreadContext {
#[derive(PartialEq, Debug)]
pub struct Thread {
name: String,
pub process: Option<Process>,
pub process: Option<Rc<RefCell<Process>>>,
pub thread_context: ThreadContext,
pub stack_pointer: i32,
object_type: ObjectType
@@ -66,6 +68,12 @@ impl Thread {
self.name.clone()
}
/// Return reference to an optional Process
/// can be None if Thread hasn't been initialize
pub fn get_process_owner(&self) -> &Option<Rc<RefCell<Process>>> {
&self.process
}
}
impl Drop for Thread {