Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8194860

Cleanup Semaphore timed-wait time calculations

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 13
    • 11
    • hotspot
    • b06

      JDK-8130039 is refactoring the Semaphore implementation into OS X, POSIX and Windows variants.

      For the POSIX platforms (Linux, BSD, Solaris) we have per-platform functions to create the timespec for the timeout of timed-wait:

      - Linux has the correct implementation for POSIX, using clock_gettime(CLOCK_REALTIME) and enforcing a time overflow check as described in os_posix.cpp

      - Solaris has a similar implementation to Linux but incorrectly uses gettimeofday instead of clock_gettime(CLOCK_REALTIME) as actually required by the sem_timedwait function!

      - BSD calls a non-existent unpackTime method! (this is dead code in OpenJDK at present as the BSD port is being maintained in a separate project not mainline due to lack of support).

      We should have a single POSIX compliant mechanism to define the timespec to be used for all the platforms.

      Given we already have code to dynamically check for the availability of clock_gettime in os_posix.cpp we should be able to leverage that. (Ideally we eventually will assume it always exists and statically bind it). We may have to expose the os::Posix API's to PosixSemaphore.

            dholmes David Holmes
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: