scheduler: sched_terminateprogram()

This commit is contained in:
Matheus
2024-05-22 17:10:33 -03:00
parent a8970c4b27
commit 6bc3747856
4 changed files with 18 additions and 16 deletions
+13
View File
@@ -407,6 +407,19 @@ void sched_stopotherthreads() {
proc->nomorethreads = false;
}
void sched_terminateprogram(int status) {
thread_t *thread = _cpu()->thread;
proc_t *proc = thread->proc;
if (spinlock_try(&proc->exiting) == false)
sched_threadexit();
sched_stopotherthreads();
proc->status = status;
sched_threadexit();
}
static void yield(context_t *context) {
thread_t *thread = _cpu()->thread;