@@ -5228,6 +5228,10 @@ class INTERPRETER_CLASS
5228
5228
restoreInternalNativeStackFrame (REGISTER_ARGS);
5229
5229
/* Handle the virtual thread Object.wait call. */
5230
5230
J9VMJAVALANGVIRTUALTHREAD_SET_NOTIFIED (_currentThread, _currentThread->threadObject , JNI_FALSE);
5231
+ /* VirtualThread.timeout is a private field used by both VM and JCL to temporarily hold
5232
+ * the value of expected wait/park time before a wake up task is scheduled using the value.
5233
+ */
5234
+ J9VMJAVALANGVIRTUALTHREAD_SET_TIMEOUT (_currentThread, _currentThread->threadObject , millis + (nanos / 1000000 ));
5231
5235
rc = yieldPinnedContinuation (REGISTER_ARGS, newState, J9VM_CONTINUATION_RETURN_FROM_OBJECT_WAIT);
5232
5236
} else {
5233
5237
rc = THROW_MONITOR_ALLOC_FAIL;
@@ -5777,7 +5781,18 @@ class INTERPRETER_CLASS
5777
5781
omrthread_monitor_t monitor = getMonitorForWait (_currentThread, waitObject);
5778
5782
monitor->count = _currentThread->currentContinuation ->waitingMonitorEnterCount ;
5779
5783
_currentThread->currentContinuation ->waitingMonitorEnterCount = 0 ;
5780
- returnVoidFromINL(REGISTER_ARGS, 4);
5784
+ _currentThread->ownedMonitorCount -= 1 ;
5785
+ if (J9VMJAVALANGTHREAD_DEADINTERRUPT (_currentThread, _currentThread->threadObject )) {
5786
+ /* Build a native frame on vthread stack before throwing exception. */
5787
+ buildInternalNativeStackFrame (REGISTER_ARGS);
5788
+ updateVMStruct (REGISTER_ARGS);
5789
+ prepareForExceptionThrow (_currentThread);
5790
+ setCurrentException (_currentThread, J9VMCONSTANTPOOL_JAVALANGINTERRUPTEDEXCEPTION, NULL );
5791
+ VMStructHasBeenUpdated (REGISTER_ARGS);
5792
+ rc = GOTO_THROW_CURRENT_EXCEPTION;
5793
+ } else {
5794
+ returnVoidFromINL (REGISTER_ARGS, 4 );
5795
+ }
5781
5796
}
5782
5797
break ;
5783
5798
}
0 commit comments