prevent garbage collection as vm shuts down

This commit is contained in:
Joshua Warner 2013-02-22 16:33:07 -07:00
parent dbbd4e7d40
commit fc84f62a65
2 changed files with 4 additions and 2 deletions

View File

@ -2885,7 +2885,8 @@ doCollect(Thread* t, Heap::CollectionType type)
}
if ((root(t, Machine::ObjectsToFinalize) or root(t, Machine::ObjectsToClean))
and m->finalizeThread == 0)
and m->finalizeThread == 0
and t->state != Thread::ExitState)
{
m->finalizeThread = m->processor->makeThread
(m, root(t, Machine::FinalizerThread), m->rootThread);
@ -3452,7 +3453,7 @@ enter(Thread* t, Thread::State s)
switch (t->state) {
case Thread::ExclusiveState: {
assert(t, t->m->exclusive == t);
t->m->exclusive = 0;
// exit state should also be exclusive, so don't set exclusive = 0
t->m->stateLock->notifyAll(t->systemThread);
} break;

View File

@ -1972,6 +1972,7 @@ addThread(Thread* t, Thread* p)
ACQUIRE_RAW(t, t->m->stateLock);
assert(t, p->state == Thread::NoState);
expect(t, t->state == Thread::ActiveState || t->state == Thread::ExclusiveState);
p->state = Thread::IdleState;
++ t->m->threadCount;