Allow running export_runtime() twice without ill-effect.
A following patch will allow migrating sleeping threads, and migrating it
again before it got to run is possible.

Signed-off-by: Nadav Har'El <[email protected]>
---
 core/sched.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/core/sched.cc b/core/sched.cc
index 0507d2c..e0fd264 100644
--- a/core/sched.cc
+++ b/core/sched.cc
@@ -1471,8 +1471,10 @@ size_t kernel_tls_size()
 
 void thread_runtime::export_runtime()
 {
-    _Rtt /= cpu::current()->c;;
-    _renormalize_count = -1; // special signal to update_after_sleep()
+    if (_renormalize_count != -1) {
+        _Rtt /= cpu::current()->c;;
+        _renormalize_count = -1; // special signal to update_after_sleep()
+    }
 }
 
 void thread_runtime::update_after_sleep()
-- 
2.5.5

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to