syscalls: start trying to add nanosleep syscall
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "../include/string.h"
|
||||
#include "../include/liballoc.h"
|
||||
#include "../include/gdt.h"
|
||||
#include "../include/isr.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
@@ -67,6 +68,8 @@ Process* task_create(uint32_t func, uint32_t user_esp, uint32_t ring, uint32_t*
|
||||
p->context->eip = (uint32_t)trapret;
|
||||
p->kesp = (uint32_t)sp;
|
||||
|
||||
p->wake_up_time = 0;
|
||||
|
||||
p->next = 0;
|
||||
|
||||
if (!queue) {
|
||||
@@ -133,6 +136,11 @@ void schedule() {
|
||||
current = queue; // Start search from the beginning
|
||||
}
|
||||
|
||||
if(current->wake_up_time > timer_ticks)
|
||||
{
|
||||
current = queue;
|
||||
}
|
||||
|
||||
// Find the next ready process to run
|
||||
Process* next = current ? current->next : NULL;
|
||||
if (!next) next = queue;
|
||||
|
||||
Reference in New Issue
Block a user