sched: finish preparing scheduler for rewrite

This commit is contained in:
Matheus
2024-09-21 23:06:37 -03:00
parent cc6477d46d
commit 0bff52b41e
19 changed files with 332 additions and 330 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ syscallret_t syscall_pause(context_t *) {
.ret = -1
};
sched_preparesleep(true);
sched_prepare_sleep(true);
sched_yield();
return ret;
+3 -3
View File
@@ -25,9 +25,9 @@ syscallret_t syscall_nanosleep(context_t *, timespec_t *utime, timespec_t *remai
}
timerentry_t sleepentry;
sched_preparesleep(true);
sched_prepare_sleep(true);
sched_targetcpu(current_cpu());
sched_target_cpu(current_cpu());
timer_insert(current_cpu()->timer, &sleepentry, timeout, current_thread(), time.s * 1000000 + time.ns / 1000, false);
ret.errno = sched_yield() == SCHED_WAKEUP_REASON_INTERRUPTED ? EINTR : 0;
@@ -39,7 +39,7 @@ syscallret_t syscall_nanosleep(context_t *, timespec_t *utime, timespec_t *remai
ret.errno = usercopy_touser(remaining, &time, sizeof(timespec_t)) ? EFAULT : EINTR;
}
sched_targetcpu(NULL);
sched_target_cpu(NULL);
ret.ret = 0;
return ret;
+2 -2
View File
@@ -71,7 +71,7 @@ syscallret_t syscall_waitpid(context_t *context, pid_t pid, int *status, int opt
stopped = true;
}
zombie = iterator->state == SCHED_PROC_STATE_ZOMBIE;
zombie = iterator->state == PROC_STATE_ZOMBIE;
}
if (zombie || continued || stopped)
@@ -114,7 +114,7 @@ syscallret_t syscall_waitpid(context_t *context, pid_t pid, int *status, int opt
threadlist = threadlist->procnext;
volatile int *flags = (volatile int *)(&freethread->flags);
// wait until the thread can actually be unallocated
while ((*flags & SCHED_THREAD_FLAGS_DEAD) == 0)
while ((*flags & THREAD_FLAGS_DEAD) == 0)
sched_yield();
sched_destroythread(freethread);