permit state transitions from idle to exclusive

This commit is contained in:
Joel Dice 2008-01-17 18:47:32 -07:00
parent 090cd8a209
commit e2fc8a62c7
2 changed files with 10 additions and 3 deletions

View File

@ -551,7 +551,6 @@ Java_java_lang_Runtime_load(Thread* t, jclass, jstring name, jboolean mapName)
extern "C" JNIEXPORT void JNICALL extern "C" JNIEXPORT void JNICALL
Java_java_lang_Runtime_gc(Thread* t, jobject) Java_java_lang_Runtime_gc(Thread* t, jobject)
{ {
ENTER(t, Thread::ActiveState);
ENTER(t, Thread::ExclusiveState); ENTER(t, Thread::ExclusiveState);
collect(t, Heap::MajorCollection); collect(t, Heap::MajorCollection);

View File

@ -2036,13 +2036,21 @@ enter(Thread* t, Thread::State s)
switch (s) { switch (s) {
case Thread::ExclusiveState: { case Thread::ExclusiveState: {
assert(t, t->state == Thread::ActiveState);
while (t->m->exclusive) { while (t->m->exclusive) {
// another thread got here first. // another thread got here first.
ENTER(t, Thread::IdleState); ENTER(t, Thread::IdleState);
} }
switch (t->state) {
case Thread::ActiveState: break;
case Thread::IdleState: {
++ t->m->activeCount;
} break;
default: abort(t);
}
t->state = Thread::ExclusiveState; t->state = Thread::ExclusiveState;
t->m->exclusive = t; t->m->exclusive = t;