Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return from park immediately for non-positive time since epoch #20802

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions runtime/vm/threadpark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,24 @@ threadParkImpl(J9VMThread *vmThread, BOOLEAN timeoutIsEpochRelative, I_64 timeou
J9JavaVM *vm = vmThread->javaVM;

/* Trc_JCL_park_Entry(vmThread, timeoutIsEpochRelative, timeout); */
if ((0 != timeout) || (timeoutIsEpochRelative)) {
if ((0 != timeout) || timeoutIsEpochRelative) {
if (timeoutIsEpochRelative) {
/* Currently, the omrthread layer provides no direct support for absolute timeouts.
* Simulate the timeout by calculating the delta from the current time.
*/
PORT_ACCESS_FROM_VMC(vmThread);
I_64 timeNow = j9time_current_time_millis();
if (timeout <= 0) {
rc = J9THREAD_TIMED_OUT;
} else {
/* Currently, the omrthread layer provides no direct support for absolute timeouts.
* Simulate the timeout by calculating the delta from the current time.
*/
PORT_ACCESS_FROM_VMC(vmThread);
I_64 timeNow = j9time_current_time_millis();

millis = timeout - timeNow;
nanos = 0;
millis = timeout - timeNow;
nanos = 0;

if (millis <= 0) {
rc = J9THREAD_TIMED_OUT;
/*Trc_JCL_park_timeIsInPast(vmThread, timeNow);*/
if (millis <= 0) {
rc = J9THREAD_TIMED_OUT;
/* Trc_JCL_park_timeIsInPast(vmThread, timeNow); */
}
}
} else {
millis = timeout / oneMillion;
Expand Down