kernel/undertaker: Make sure the thread isn't running anymore
This commit is contained in:
parent
7e1c4534df
commit
a1feba678d
@ -1112,6 +1112,11 @@ undertaker(void* /*args*/)
|
|||||||
// we've got an entry
|
// we've got an entry
|
||||||
Thread* thread = entry.thread;
|
Thread* thread = entry.thread;
|
||||||
|
|
||||||
|
// make sure the thread isn't running anymore
|
||||||
|
InterruptsSpinLocker schedulerLocker(thread->scheduler_lock);
|
||||||
|
ASSERT(thread->state == THREAD_STATE_FREE_ON_RESCHED);
|
||||||
|
schedulerLocker.Unlock();
|
||||||
|
|
||||||
// remove this thread from from the kernel team -- this makes it
|
// remove this thread from from the kernel team -- this makes it
|
||||||
// unaccessible
|
// unaccessible
|
||||||
Team* kernelTeam = team_get_kernel_team();
|
Team* kernelTeam = team_get_kernel_team();
|
||||||
@ -2254,12 +2259,13 @@ thread_exit(void)
|
|||||||
|
|
||||||
disable_interrupts();
|
disable_interrupts();
|
||||||
|
|
||||||
|
SpinLocker schedulerLocker(thread->scheduler_lock);
|
||||||
|
|
||||||
SpinLocker undertakerLocker(sUndertakerLock);
|
SpinLocker undertakerLocker(sUndertakerLock);
|
||||||
sUndertakerEntries.Add(&undertakerEntry);
|
sUndertakerEntries.Add(&undertakerEntry);
|
||||||
sUndertakerCondition.NotifyOne();
|
sUndertakerCondition.NotifyOne();
|
||||||
undertakerLocker.Unlock();
|
undertakerLocker.Unlock();
|
||||||
|
|
||||||
SpinLocker schedulerLocker(thread->scheduler_lock);
|
|
||||||
thread->next_state = THREAD_STATE_FREE_ON_RESCHED;
|
thread->next_state = THREAD_STATE_FREE_ON_RESCHED;
|
||||||
scheduler_reschedule();
|
scheduler_reschedule();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user