[haiku-commits] r42041 - haiku/branches/developer/bonefish/signals/src/system/kernel

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 8 Jun 2011 04:17:31 +0200 (CEST)

Author: bonefish
Date: 2011-06-08 04:17:31 +0200 (Wed, 08 Jun 2011)
New Revision: 42041
Changeset: https://dev.haiku-os.org/changeset/42041

Modified:
   haiku/branches/developer/bonefish/signals/src/system/kernel/thread.cpp
Log:
_user_snooze_etc(): When converting a relative timeout to an absolute one,
convert the time base from real-time to system time before getting the time. We
did compute an absolute real-time value, but used that with system timebase
afterwards.


Modified: haiku/branches/developer/bonefish/signals/src/system/kernel/thread.cpp
===================================================================
--- haiku/branches/developer/bonefish/signals/src/system/kernel/thread.cpp      
2011-06-08 02:05:04 UTC (rev 42040)
+++ haiku/branches/developer/bonefish/signals/src/system/kernel/thread.cpp      
2011-06-08 02:17:31 UTC (rev 42041)
@@ -3440,6 +3440,14 @@
                // convert relative timeouts to absolute ones
                if ((flags & B_RELATIVE_TIMEOUT) != 0) {
                        // not restarted yet and the flags indicate a relative 
timeout
+
+                       // Make sure we use the system time base, so real-time 
clock changes
+                       // won't affect our wait.
+                       flags &= ~(uint32)B_TIMEOUT_REAL_TIME_BASE;
+                       if (timebase == CLOCK_REALTIME)
+                               timebase = CLOCK_MONOTONIC;
+
+                       // get the current time and make the timeout absolute
                        bigtime_t now;
                        status_t error = user_timer_get_clock(timebase, now);
                        if (error != B_OK)
@@ -3452,12 +3460,6 @@
                                timeout = B_INFINITE_TIMEOUT;
 
                        flags = (flags & ~B_RELATIVE_TIMEOUT) | 
B_ABSOLUTE_TIMEOUT;
-
-                       // Make sure we use the system time base, so real-time 
clock changes
-                       // won't affect our wait.
-                       flags &= ~(uint32)B_TIMEOUT_REAL_TIME_BASE;
-                       if (timebase == CLOCK_REALTIME)
-                               timebase = CLOCK_MONOTONIC;
                } else
                        flags |= B_ABSOLUTE_TIMEOUT;
        }


Other related posts:

  • » [haiku-commits] r42041 - haiku/branches/developer/bonefish/signals/src/system/kernel - ingo_weinhold