summaryrefslogtreecommitdiff
path: root/kernel/sched
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-06-26 18:33:59 +0200
committerAnton Kling <anton@kling.gg>2024-06-26 18:36:23 +0200
commit823f56f35158ecf541900441a68a238f0b2c961d (patch)
tree6c4c23374fe835f0deb67309cf84be1a86a943ce /kernel/sched
parentb857f43b58b4e1e14e069afe1da6f6a05f3e6d9c (diff)
Scheduler: Don't run switch_task() if task switch is already occuring
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/scheduler.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/sched/scheduler.c b/kernel/sched/scheduler.c
index b249e3d..b75b7ff 100644
--- a/kernel/sched/scheduler.c
+++ b/kernel/sched/scheduler.c
@@ -367,9 +367,7 @@ int isset_fdhalt(process_t *p, int *empty) {
if (NULL == p) {
p = current_task;
}
- disable_interrupts();
if (p->dead) {
- enable_interrupts();
return 1;
}
int blocked = 0;
@@ -385,7 +383,6 @@ int isset_fdhalt(process_t *p, int *empty) {
*empty = 0;
if (inode->_has_data) {
if (inode->_has_data(inode)) {
- enable_interrupts();
return 0;
}
}
@@ -399,7 +396,6 @@ int isset_fdhalt(process_t *p, int *empty) {
*empty = 0;
if (inode->_can_write) {
if (inode->_can_write(inode)) {
- enable_interrupts();
return 0;
}
}
@@ -412,12 +408,10 @@ int isset_fdhalt(process_t *p, int *empty) {
}
*empty = 0;
if (!inode->is_open) {
- enable_interrupts();
return 0;
}
blocked = 1;
}
- enable_interrupts();
return blocked;
}
@@ -515,6 +509,7 @@ int kill(pid_t pid, int sig) {
return 0;
}
+int is_switching_tasks = 0;
void switch_task() {
if (!current_task) {
return;
@@ -526,9 +521,11 @@ void switch_task() {
current_task = ready_queue;
}
} else {
+ is_switching_tasks = 1;
enable_interrupts();
current_task = next_task((process_t *)current_task);
disable_interrupts();
+ is_switching_tasks = 0;
}
active_directory = current_task->cr3;