mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20: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) {
|
if (t->state == Thread::IdleState and t->m->exclusive == 0) {
|
||||||
// fast path
|
// fast path
|
||||||
INCREMENT(&(t->m->activeCount), 1);
|
INCREMENT(&(t->m->activeCount), 1);
|
||||||
t->state = s;
|
|
||||||
break;
|
if (t->m->exclusive) {
|
||||||
} else {
|
// a thread has entered exclusive mode - switch to slow path
|
||||||
ACQUIRE_LOCK;
|
assert(t, t->m->activeCount > 0);
|
||||||
|
INCREMENT(&(t->m->activeCount), -1);
|
||||||
|
} else {
|
||||||
|
t->state = s;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{ ACQUIRE_LOCK;
|
||||||
|
|
||||||
switch (t->state) {
|
switch (t->state) {
|
||||||
case Thread::ExclusiveState: {
|
case Thread::ExclusiveState: {
|
||||||
|
Loading…
Reference in New Issue
Block a user