Skip to content

Commit 2ff585f

Browse files
authored
Merge pull request #21510 from babsingh/v0.51.0-release-v2
(0.51) Pin virtual threads while they hold raw monitors
2 parents bfda021 + 172da93 commit 2ff585f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

runtime/jvmti/jvmtiRawMonitor.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ jvmtiRawMonitorEnter(jvmtiEnv* env,
135135
}
136136
}
137137
#if JAVA_SPEC_VERSION >= 19
138-
currentThread->ownedMonitorCount += 1;
138+
if (UDATA_MAX != currentThread->continuationPinCount) {
139+
currentThread->continuationPinCount += 1;
140+
}
139141
#endif /* JAVA_SPEC_VERSION >= 19 */
140142
} else {
141143
#if defined(J9VM_INTERP_ATOMIC_FREE_JNI)
@@ -174,7 +176,9 @@ jvmtiRawMonitorExit(jvmtiEnv* env,
174176
rc = JVMTI_ERROR_NOT_MONITOR_OWNER;
175177
#if JAVA_SPEC_VERSION >= 19
176178
} else {
177-
currentThread->ownedMonitorCount -= 1;
179+
if (0 != currentThread->continuationPinCount) {
180+
currentThread->continuationPinCount -= 1;
181+
}
178182
#endif /* JAVA_SPEC_VERSION >= 19 */
179183
}
180184

0 commit comments

Comments
 (0)