mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
fix race condition introduced in previous commit
This commit is contained in:
parent
75934c8342
commit
3418a8bcbe
@ -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: {
|
||||
|
Loading…
Reference in New Issue
Block a user