changeset 5513:63574c639b1d

Merge
author asaha
date Wed, 09 Apr 2014 14:07:17 -0700
parents 7df501a095c5 (current diff) 2793b550b13e (diff)
children f30a8a82c54f f0f39dbf68aa
files .hgtags src/os/linux/vm/os_linux.cpp
diffstat 2 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Apr 08 11:34:21 2014 -0700
+++ b/.hgtags	Wed Apr 09 14:07:17 2014 -0700
@@ -652,6 +652,7 @@
 a2ac67a2c1cc867a8d6b525ab1df17204186e636 jdk7u60-b11
 cae50351dcece6e5bf215eabf958c5d669ffff1f jdk7u60-b12
 5853131ba4b448c5d89a3f0aa501fdf07f3b473c jdk7u60-b13
+b226be2040f971855626f5b88cb41a7d5299fea0 jdk7u60-b14
 4a9635c98a917cfcef506ca5d034c733a33c53f3 jdk7u65-b01
 eb797fab50d3b440b17b3e7c5d83f42bfa73655e jdk7u65-b02
 bb00df28ecdbd0da89ab4ed81f6f2b732fa512da jdk7u65-b03
--- a/src/os/linux/vm/os_linux.cpp	Tue Apr 08 11:34:21 2014 -0700
+++ b/src/os/linux/vm/os_linux.cpp	Wed Apr 09 14:07:17 2014 -0700
@@ -128,6 +128,8 @@
 
 #define MAX_PATH    (2 * K)
 
+#define MAX_SECS 100000000
+
 // for timer info max values which include all bits
 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
 
@@ -2480,7 +2482,6 @@
     sem_t _semaphore;
 };
 
-
 Semaphore::Semaphore() {
   sem_init(&_semaphore, 0, 0);
 }
@@ -2502,8 +2503,22 @@
 }
 
 bool Semaphore::timedwait(unsigned int sec, int nsec) {
+
   struct timespec ts;
-  unpackTime(&ts, false, (sec * NANOSECS_PER_SEC) + nsec);
+  // Semaphore's are always associated with CLOCK_REALTIME
+  os::Linux::clock_gettime(CLOCK_REALTIME, &ts);
+  // see unpackTime for discussion on overflow checking
+  if (sec >= MAX_SECS) {
+    ts.tv_sec += MAX_SECS;
+    ts.tv_nsec = 0;
+  } else {
+    ts.tv_sec += sec;
+    ts.tv_nsec += nsec;
+    if (ts.tv_nsec >= NANOSECS_PER_SEC) {
+      ts.tv_nsec -= NANOSECS_PER_SEC;
+      ++ts.tv_sec; // note: this must be <= max_secs
+    }
+  }
 
   while (1) {
     int result = sem_timedwait(&_semaphore, &ts);
@@ -5795,7 +5810,6 @@
  * is no need to track notifications.
  */
 
-#define MAX_SECS 100000000
 /*
  * This code is common to linux and solaris and will be moved to a
  * common place in dolphin.