Rename multitasking module to threads

This commit is contained in:
Philipp Oppermann
2020-01-23 09:18:00 +01:00
parent 11a0eb679c
commit cd138a3a1b
4 changed files with 10 additions and 5 deletions

View File

@@ -77,7 +77,7 @@ extern "x86-interrupt" fn timer_interrupt_handler(_stack_frame: &mut InterruptSt
PICS.lock()
.notify_end_of_interrupt(InterruptIndex::Timer.as_u8());
}
crate::multitasking::scheduler();
crate::threads::scheduler();
}
extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: &mut InterruptStackFrame) {

View File

@@ -22,8 +22,8 @@ pub mod allocator;
pub mod gdt;
pub mod interrupts;
pub mod memory;
pub mod multitasking;
pub mod serial;
pub mod threads;
pub mod vga_buffer;
pub fn init() {

View File

@@ -54,7 +54,7 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
#[cfg(test)]
test_main();
use blog_os::multitasking::{create_thread, create_thread_from_closure};
use blog_os::threads::{create_thread, create_thread_from_closure};
create_thread(thread_1, 1, &mut mapper, &mut frame_allocator);
create_thread(thread_2, 1, &mut mapper, &mut frame_allocator);

View File

@@ -17,7 +17,9 @@ pub unsafe fn context_switch(stack_pointer: VirtAddr) {
pub fn scheduler() {
let next = PAUSED_THREADS.try_lock().and_then(|mut paused_threads| {
paused_threads.as_mut().and_then(|threads| threads.pop_front())
paused_threads
.as_mut()
.and_then(|threads| threads.pop_front())
});
if let Some(next) = next {
unsafe { context_switch(next) };
@@ -32,7 +34,10 @@ fn add_paused_thread(stack_pointer: VirtAddr) {
}
fn add_thread(stack_pointer: VirtAddr) {
PAUSED_THREADS.lock().get_or_insert_with(VecDeque::new).push_back(stack_pointer);
PAUSED_THREADS
.lock()
.get_or_insert_with(VecDeque::new)
.push_back(stack_pointer);
}
pub fn create_thread(