-
Notifications
You must be signed in to change notification settings - Fork 728
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
base: master
Are you sure you want to change the base?
Conversation
runtime/vm/threadpark.cpp
Outdated
/* Currently, the omrthread layer provides no direct support for absolute timeouts. | ||
* Simulate the timeout by calculating the delta from the current time. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please correct the indentation of lines 54, 55.
runtime/vm/threadpark.cpp
Outdated
* Simulate the timeout by calculating the delta from the current time. | ||
*/ | ||
PORT_ACCESS_FROM_VMC(vmThread); | ||
if () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this was added in error.
runtime/vm/threadpark.cpp
Outdated
@@ -47,18 +47,23 @@ threadParkImpl(J9VMThread *vmThread, BOOLEAN timeoutIsEpochRelative, I_64 timeou | |||
/* Trc_JCL_park_Entry(vmThread, timeoutIsEpochRelative, timeout); */ | |||
if ((0 != timeout) || (timeoutIsEpochRelative)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're here, please remove the redundant parentheses:
if ((0 != timeout) || timeoutIsEpochRelative) {
runtime/vm/threadpark.cpp
Outdated
/*Trc_JCL_park_timeIsInPast(vmThread, timeNow);*/ | ||
if (millis <= 0) { | ||
rc = J9THREAD_TIMED_OUT; | ||
/*Trc_JCL_park_timeIsInPast(vmThread, timeNow);*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add spaces in the comment (see line 47):
/* Trc_JCL_park_timeIsInPast(vmThread, timeNow); */
Rather than "negative" the description should say "non-positive", unless the intent was "negative" in which case the code needs to be corrected. |
Signed-off-by: Theresa Mammarella <[email protected]>
If the deadline since epoch given to Unsafe.park is negative the calculation of
mills
could overflow. To prevent this set the return code toJ9THREAD_TIMED_OUT
for non-positive deadlines since they have always passed.Related to: #17135