diff --git a/src/os/solaris/vm/os_solaris.cpp b/src/os/solaris/vm/os_solaris.cpp index 08a16b763696801a96ec80986676b38ed3ae1eaf..55f7ddcddb3e525873387cbf54dbeb6d46ce4b74 100644 --- a/src/os/solaris/vm/os_solaris.cpp +++ b/src/os/solaris/vm/os_solaris.cpp @@ -3375,7 +3375,12 @@ static int os_sleep(jlong millis, bool interruptible) { // INTERRUPTIBLE_NORESTART_VM_ALWAYS returns res == OS_INTRPT for // thread.Interrupt. - if((res == OS_ERR) && (errno == EINTR)) { + // See c/r 6751923. Poll can return 0 before time + // has elapsed if time is set via clock_settime (as NTP does). + // res == 0 if poll timed out (see man poll RETURN VALUES) + // using the logic below checks that we really did + // sleep at least "millis" if not we'll sleep again. + if( ( res == 0 ) || ((res == OS_ERR) && (errno == EINTR))) { newtime = getTimeMillis(); assert(newtime >= prevtime, "time moving backwards"); /* Doing prevtime and newtime in microseconds doesn't help precision,