mirror of
https://github.com/corda/corda.git
synced 2025-01-19 11:16:54 +00:00
delay incrementing Thread::criticalLevel until after entering ActiveState
If we increment the value while we're still in IdleState, another thread may try to GC before we are able to enter ActiveState, which will lead to an assertion failure when the footprint function is called.
This commit is contained in:
parent
07e3294937
commit
dc943c250a
@ -160,10 +160,12 @@ GetStringRegion(Thread* t, jstring s, jsize start, jsize length, jchar* dst)
|
||||
const jchar* JNICALL
|
||||
GetStringCritical(Thread* t, jstring s, jboolean* isCopy)
|
||||
{
|
||||
if ((t->criticalLevel ++) == 0) {
|
||||
if (t->criticalLevel == 0) {
|
||||
enter(t, Thread::ActiveState);
|
||||
}
|
||||
|
||||
++ t->criticalLevel;
|
||||
|
||||
if (isCopy) {
|
||||
*isCopy = true;
|
||||
}
|
||||
@ -3141,9 +3143,11 @@ SetDoubleArrayRegion(Thread* t, jdoubleArray array, jint offset, jint length,
|
||||
void* JNICALL
|
||||
GetPrimitiveArrayCritical(Thread* t, jarray array, jboolean* isCopy)
|
||||
{
|
||||
if ((t->criticalLevel ++) == 0) {
|
||||
if (t->criticalLevel == 0) {
|
||||
enter(t, Thread::ActiveState);
|
||||
}
|
||||
|
||||
++ t->criticalLevel;
|
||||
|
||||
if (isCopy) {
|
||||
*isCopy = true;
|
||||
|
Loading…
Reference in New Issue
Block a user