You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2015/12/17 02:54:03 UTC

trafficserver git commit: TS-4028: Set TrackerContinuation to clean up. This close #384.

Repository: trafficserver
Updated Branches:
  refs/heads/master a53a2f600 -> 665147595


TS-4028: Set TrackerContinuation to clean up.
This close #384.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/66514759
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/66514759
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/66514759

Branch: refs/heads/master
Commit: 66514759571690898f089fdeb338c4c49e4ebe18
Parents: a53a2f6
Author: Alan M. Carroll <am...@apache.org>
Authored: Wed Dec 16 19:42:02 2015 -0600
Committer: Alan M. Carroll <am...@apache.org>
Committed: Wed Dec 16 19:53:30 2015 -0600

----------------------------------------------------------------------
 proxy/Main.cc | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/66514759/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 7e91eaf..5fc8f86 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -283,9 +283,17 @@ public:
     baseline_taken = 0;
   }
 
+  ~TrackerContinuation() { mutex = NULL; }
+
   int
-  periodic(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
+  periodic(int event, Event * /* e ATS_UNUSED */)
   {
+    if (event == EVENT_IMMEDIATE) {
+      // rescheduled from periodic to immediate event
+      // this is the indication to terminate this tracker.
+      delete this;
+      return EVENT_DONE;
+    }
     if (use_baseline) {
       // TODO: TS-567 Integrate with debugging allocators "dump" features?
       ink_freelists_dump_baselinerel(stderr);
@@ -337,19 +345,23 @@ static int
 init_memory_tracker(const char *config_var, RecDataT /* type ATS_UNUSED */, RecData data, void * /* cookie ATS_UNUSED */)
 {
   static Event *tracker_event = NULL;
+  Event *preE;
   int dump_mem_info_frequency = 0;
 
+  // set tracker_event to NULL, and return previous value
+  preE = ink_atomic_swap(&tracker_event, static_cast<Event *>(NULL));
+
   if (config_var) {
     dump_mem_info_frequency = data.rec_int;
   } else {
     dump_mem_info_frequency = REC_ConfigReadInteger("proxy.config.dump_mem_info_frequency");
   }
 
-  Debug("tracker", "init_tracker called [%d]\n", dump_mem_info_frequency);
+  Debug("tracker", "init_memory_tracker called [%d]\n", dump_mem_info_frequency);
 
-  if (tracker_event) {
-    tracker_event->cancel();
-    tracker_event = NULL;
+  if (preE) {
+    eventProcessor.schedule_imm(preE->continuation, ET_CALL);
+    preE->cancel();
   }
 
   if (dump_mem_info_frequency > 0) {