mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-28 21:28:21 +00:00
sched: finish preparing scheduler for rewrite
This commit is contained in:
@@ -6,7 +6,7 @@ syscallret_t syscall_pause(context_t *) {
|
||||
.ret = -1
|
||||
};
|
||||
|
||||
sched_preparesleep(true);
|
||||
sched_prepare_sleep(true);
|
||||
sched_yield();
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user