Skip to content

Commit 8cdf2bc

Browse files
committed
Correctly handle notify before wait for virtual threads
If a notify is issued before wait, then there waitingContinuations will be NULL. In this case, the notify steps should not be executed since there are no virtual threads waiting, and waitingContinuations->vthread will be NULL. Addresses point 3 in the below Github comment: eclipse-openj9#20369 (comment). Signed-off-by: Babneet Singh <[email protected]>
1 parent ddd5a1a commit 8cdf2bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

runtime/vm/BytecodeInterpreter.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2943,7 +2943,7 @@ class INTERPRETER_CLASS
29432943
if ((NULL != objectMonitor) && (NULL != objectMonitor->waitingContinuations)) {
29442944
omrthread_monitor_enter(_vm->blockedVirtualThreadsMutex);
29452945
J9VMContinuation *head = objectMonitor->waitingContinuations;
2946-
if (NULL != head) {
2946+
if ((NULL != head) && (NULL != head->vthread)) {
29472947
if (omrthread_monitor_notify == notifyFunction) {
29482948
objectMonitor->waitingContinuations = head->nextWaitingContinuation;
29492949
head->nextWaitingContinuation = _vm->blockedContinuations;

0 commit comments

Comments
 (0)