From 792497b14c61d592b8e3608fd9a2caf58c07d94e Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Wed, 1 Mar 2023 11:16:21 +0100 Subject: [PATCH] Change var name to fit with rust conventions --- src/kernel/scheduler.rs | 6 +++--- src/kernel/thread.rs | 2 +- src/utility/system.rs | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/kernel/scheduler.rs b/src/kernel/scheduler.rs index 207c5e6..7cfe0ee 100644 --- a/src/kernel/scheduler.rs +++ b/src/kernel/scheduler.rs @@ -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()); diff --git a/src/kernel/thread.rs b/src/kernel/thread.rs index 9b0354d..922df0e 100644 --- a/src/kernel/thread.rs +++ b/src/kernel/thread.rs @@ -37,7 +37,7 @@ impl Thread { pc: 0 }, stack_pointer: 0, - object_type: ObjectType::THREAD_TYPE + object_type: ObjectType::ThreadType } } diff --git a/src/utility/system.rs b/src/utility/system.rs index f5b8b50..4c274ec 100644 --- a/src/utility/system.rs +++ b/src/utility/system.rs @@ -6,17 +6,17 @@ use crate::kernel::thread::Thread; extern crate lazy_static; lazy_static! { - pub static ref g_current_thread: RwLock> = RwLock::new(Option::None); - pub static ref g_thread_to_be_destroyed: RwLock> = RwLock::new(Option::None); + pub static ref G_CURRENT_THREAD: RwLock> = RwLock::new(Option::None); + pub static ref G_THREAD_TO_BE_DESTROYED: RwLock> = 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 } \ No newline at end of file