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;
|
|
|
|
|
2023-03-01 16:55:17 +01:00
|
|
|
use crate::kernel::{thread::Thread, scheduler::Scheduler};
|
2023-03-01 15:45:49 +01:00
|
|
|
|
|
|
|
use super::list::List;
|
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! {
|
2023-03-01 11:16:21 +01:00
|
|
|
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 {
|
2023-03-01 11:16:21 +01:00
|
|
|
SemaphoreType,
|
|
|
|
LockType,
|
|
|
|
ConditionType,
|
|
|
|
FileType,
|
|
|
|
ThreadType,
|
|
|
|
InvalidType
|
2023-02-28 14:43:40 +01:00
|
|
|
}
|