burritos/src/kernel/system.rs

26 lines
802 B
Rust
Raw Normal View History

2023-03-01 16:55:17 +01:00
use std::{sync::{RwLock, Arc}};
2023-03-01 11:10:15 +01:00
use lazy_static::lazy_static;
use crate::{kernel::{thread::Thread, scheduler::Scheduler}, utility::list::List, simulator::machine::Machine};
2023-03-01 15:45:49 +01:00
2023-03-01 11:10:15 +01:00
extern crate lazy_static;
2023-03-01 10:11:19 +01:00
2023-03-01 11:10:15 +01:00
lazy_static! {
pub static ref G_MACHINE: RwLock<Machine> = RwLock::new(Machine::_init_machine());
pub static ref G_CURRENT_THREAD: RwLock<Option<Thread>> = RwLock::new(Option::None);
pub static ref G_THREAD_TO_BE_DESTROYED: RwLock<Option<Thread>> = RwLock::new(Option::None);
2023-03-01 16:55:17 +01:00
pub static ref G_ALIVE: RwLock<List<Arc<Thread>>> = RwLock::new(List::new());
pub static ref G_SCHEDULER: RwLock<Scheduler> = RwLock::new(Scheduler::new());
2023-03-01 11:10:15 +01:00
}
2023-03-01 10:11:19 +01:00
2023-02-28 14:43:40 +01:00
2023-03-01 11:10:15 +01:00
#[derive(PartialEq)]
2023-02-28 14:43:40 +01:00
pub enum ObjectType {
SemaphoreType,
LockType,
ConditionType,
FileType,
ThreadType,
InvalidType
2023-02-28 14:43:40 +01:00
}