fix race condition introduced in previous commit

This commit is contained in:
Joel Dice 2009-11-28 15:24:02 -07:00
parent 75934c8342
commit 3418a8bcbe

View File

@ -2421,10 +2421,18 @@ enter(Thread* t, Thread::State s)
if (t->state == Thread::IdleState and t->m->exclusive == 0) {
// fast path
INCREMENT(&(t->m->activeCount), 1);
t->state = s;
break;
} else {
ACQUIRE_LOCK;
if (t->m->exclusive) {
// a thread has entered exclusive mode - switch to slow path
assert(t, t->m->activeCount > 0);
INCREMENT(&(t->m->activeCount), -1);
} else {
t->state = s;
break;
}
}
{ ACQUIRE_LOCK;
switch (t->state) {
case Thread::ExclusiveState: {