forked from Rativel/BurritOS
Add new thread exception (untested)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user