You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2020/05/20 16:46:54 UTC

[trafficserver] branch 9.0.x updated: make sure time is consistent between calculations

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 5c74416  make sure time is consistent between calculations
5c74416 is described below

commit 5c7441690514e4f692a2ec8d9eb89fdbae055782
Author: Fei Deng <du...@gmail.com>
AuthorDate: Tue Nov 12 15:40:37 2019 -0600

    make sure time is consistent between calculations
    
    (cherry picked from commit f5efd7652bc924b4b5515e4116da9d6b5f6eea3a)
---
 iocore/eventsystem/UnixEThread.cc | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/iocore/eventsystem/UnixEThread.cc b/iocore/eventsystem/UnixEThread.cc
index be7a6be..df44c71 100644
--- a/iocore/eventsystem/UnixEThread.cc
+++ b/iocore/eventsystem/UnixEThread.cc
@@ -143,11 +143,7 @@ EThread::process_event(Event *e, int calling_code)
         if (e->period < 0) {
           e->timeout_at = e->period;
         } else {
-          this->get_hrtime_updated();
-          e->timeout_at = cur_time + e->period;
-          if (e->timeout_at < cur_time) {
-            e->timeout_at = cur_time;
-          }
+          e->timeout_at = Thread::get_hrtime_updated() + e->period;
         }
         EventQueueExternal.enqueue_local(e);
       }
@@ -239,7 +235,7 @@ EThread::execute_regular()
     do {
       done_one = false;
       // execute all the eligible internal events
-      EventQueue.check_ready(cur_time, this);
+      EventQueue.check_ready(loop_start_time, this);
       while ((e = EventQueue.dequeue_ready(cur_time))) {
         ink_assert(e);
         ink_assert(e->timeout_at > 0);
@@ -284,7 +280,7 @@ EThread::execute_regular()
     tail_cb->waitForActivity(sleep_time);
 
     // loop cleanup
-    loop_finish_time = this->get_hrtime_updated();
+    loop_finish_time = Thread::get_hrtime_updated();
     delta            = loop_finish_time - loop_start_time;
 
     // This can happen due to time of day adjustments (which apparently happen quite frequently). I