Change var name to fit with rust conventions
This commit is contained in:
parent
cf1c7aad5a
commit
99fc514720
@ -1,6 +1,6 @@
|
||||
use crate::utility::list::List;
|
||||
use crate::kernel::thread::Thread;
|
||||
use crate::utility::system::{g_current_thread, g_thread_to_be_destroyed};
|
||||
use crate::utility::system::{G_CURRENT_THREAD, G_THREAD_TO_BE_DESTROYED};
|
||||
|
||||
|
||||
struct Scheduler<> {
|
||||
@ -50,7 +50,7 @@ impl Scheduler {
|
||||
///
|
||||
/// **next_thread** thread to dispatch to the CPU
|
||||
pub fn switch_to(&self, next_thread: Thread) {
|
||||
match g_current_thread.write() {
|
||||
match G_CURRENT_THREAD.write() {
|
||||
Ok(mut current_thread) => {
|
||||
let old_thread = current_thread.as_mut().unwrap();
|
||||
|
||||
@ -63,7 +63,7 @@ impl Scheduler {
|
||||
current_thread.replace(next_thread);
|
||||
}
|
||||
|
||||
match g_thread_to_be_destroyed.write() {
|
||||
match G_THREAD_TO_BE_DESTROYED.write() {
|
||||
Ok(mut thread_to_be_destroyed) => {
|
||||
if thread_to_be_destroyed.is_some() {
|
||||
drop(thread_to_be_destroyed.take());
|
||||
|
@ -37,7 +37,7 @@ impl Thread {
|
||||
pc: 0
|
||||
},
|
||||
stack_pointer: 0,
|
||||
object_type: ObjectType::THREAD_TYPE
|
||||
object_type: ObjectType::ThreadType
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,17 +6,17 @@ use crate::kernel::thread::Thread;
|
||||
extern crate lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub enum ObjectType {
|
||||
SEMAPHORE_TYPE,
|
||||
LOCK_TYPE,
|
||||
CONDITION_TYPE,
|
||||
FILE_TYPE,
|
||||
THREAD_TYPE,
|
||||
INVALID_TYPE
|
||||
SemaphoreType,
|
||||
LockType,
|
||||
ConditionType,
|
||||
FileType,
|
||||
ThreadType,
|
||||
InvalidType
|
||||
}
|
Loading…
Reference in New Issue
Block a user