mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-30 05:58:22 +00:00
scheduler: sched_terminateprogram()
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user