mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-30 05:58:22 +00:00
scheduler: dequeue takes a state argument and releases a threadexit lock
This commit is contained in:
@@ -363,7 +363,7 @@ void sched_eventsignal(event_t* event, thread_t* thread){
|
||||
spinlock_release(&queues[thread->priority].lock);
|
||||
}
|
||||
|
||||
void sched_dequeue(){
|
||||
void sched_dequeue(long state){
|
||||
|
||||
timer_stop();
|
||||
arch_interrupt_disable();
|
||||
@@ -377,17 +377,18 @@ void sched_dequeue(){
|
||||
|
||||
arch_getcls()->thread = thread;
|
||||
vmm_switchcontext(thread->ctx);
|
||||
|
||||
|
||||
thread->state = state;
|
||||
if(state == THREAD_STATE_DEAD)
|
||||
spinlock_release(&thread->proc->threadexitlock);
|
||||
|
||||
switch_thread(thread);
|
||||
|
||||
|
||||
}
|
||||
|
||||
__attribute__((noreturn)) int sched_die(){
|
||||
|
||||
arch_getcls()->thread->state = THREAD_STATE_DEAD;
|
||||
|
||||
sched_dequeue();
|
||||
sched_dequeue(THREAD_STATE_DEAD);
|
||||
}
|
||||
|
||||
void sched_threadexitcheck(){
|
||||
|
||||
@@ -75,7 +75,7 @@ void syscall_exit(int status){
|
||||
spinlock_release(&proc->lock);
|
||||
spinlock_release(&init->lock);
|
||||
|
||||
sched_dequeue();
|
||||
sched_die();
|
||||
|
||||
__builtin_unreachable();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user