RFR: 8194860: Cleanup Semaphore timed-wait time calculations
coleen.phillimore at oracle.com
coleen.phillimore at oracle.com
Thu Jan 17 13:04:42 UTC 2019
http://cr.openjdk.java.net/~dholmes/8194860/webrev/src/hotspot/os/posix/os_posix.cpp.frames.html
For os_init2, I don't see why you have to sprinkle #ifndef SOLARIS. It's
just logging, won't the logging be useful in the negative for solaris?
Can these three statics default to false/NULL above? Then you can save
having to have this conditional as well:
+#else
+ _use_clock_monotonic_condattr = false;
+#endif // !SOLARIS
Thank you for resolving the differences between to_abstime and solaris
unpackTime, which was one of the causes of this mess left by the
refactoring.
Looks good, with this one suggestion to remove some #ifndef solaris above.
Coleen
On 1/16/19 5:06 PM, David Holmes wrote:
> bug: https://bugs.openjdk.java.net/browse/JDK-8194860
> webrev: http://cr.openjdk.java.net/~dholmes/8194860/webrev/
>
> Details in the bug report, but there was duplication in functionality
> with regards to timeout conversions/calculations, and the os_bsd.cpp
> code was broken due to OSXSemaphore and PosixSemaphore having
> different API's.
>
> Summary:
> - expanded the API to take a relative timeout in millis as well as the
> existing absolute timeout as a timespec:
>
> // wait until the given absolute time is reached
> bool timedwait(struct timespec ts);
> // wait until the given relative time elapses
> bool timedwait(int64_t millis);
>
> The millis version simply converts to a timespec and calls the other
> version e.g
>
> bool PosixSemaphore::timedwait(int64_t millis) {
> struct timespec ts;
> os::Posix::to_RTC_abstime(&ts, millis);
> return timedwait(ts);
> }
>
> - added os::Posix::to_RTC_abstime to do the relative to absolute
> conversion using the existing routines in os::Posix used for
> PlatformEvent etc.
>
> - changed callsites to use new millis version
>
> - I had to rearrange the ifndef SOLARIS in os_posix.cpp to expose
> previously hidden code to Solaris. It isn't all needed by Solaris but
> I chose not to clutter things with too many ifdefs and only excluded
> things that really shouldn't be done on Solaris. Also needed to call
> os::Posix::init on Solaris.
>
> Testing (still in progress):
> - mach 5 tiers 1 - 3 (Linux, Solaris, OS X, Windows)
> - test/jdk/jdk/jfr (as suspend/resume is the user of the semaphore code)
>
> Thanks,
> David
More information about the hotspot-runtime-dev
mailing list