You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by we...@apache.org on 2012/10/17 04:25:32 UTC

git commit: TS-1503 make Event::schedule simple and efficient.

Updated Branches:
  refs/heads/master ee765af82 -> a463d3433


TS-1503 make Event::schedule simple and efficient.


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

Branch: refs/heads/master
Commit: a463d3433533a97070141eebd57b410d6bbb325c
Parents: ee765af
Author: Chen Bin <ku...@taobao.com>
Authored: Wed Oct 17 10:22:27 2012 +0800
Committer: weijin <we...@apache.org>
Committed: Wed Oct 17 10:24:14 2012 +0800

----------------------------------------------------------------------
 CHANGES                         |    3 +++
 iocore/eventsystem/UnixEvent.cc |   20 ++++++++------------
 2 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a463d343/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index d816a4d..e152dd8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.3.1
+  
+  *) [TS-1503] make Event::schedule simple and efficient
+     Author: KuoTai
 
   *) [TS-1532] make esi plugin support cookie sub keys
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a463d343/iocore/eventsystem/UnixEvent.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/UnixEvent.cc b/iocore/eventsystem/UnixEvent.cc
index e34b477..d851092 100644
--- a/iocore/eventsystem/UnixEvent.cc
+++ b/iocore/eventsystem/UnixEvent.cc
@@ -37,15 +37,14 @@ Event::schedule_imm(int acallback_event)
 {
   callback_event = acallback_event;
   ink_debug_assert(ethread == this_ethread());
-  if (in_the_prot_queue)
-    ethread->EventQueueExternal.remove(this);
   if (in_the_priority_queue)
     ethread->EventQueue.remove(this);
   timeout_at = 0;
   period = 0;
   immediate = true;
   mutex = continuation->mutex;
-  ethread->EventQueueExternal.enqueue_local(this);
+  if (!in_the_prot_queue)
+    ethread->EventQueueExternal.enqueue_local(this);
 }
 
 void
@@ -54,15 +53,14 @@ Event::schedule_at(ink_hrtime atimeout_at, int acallback_event)
   callback_event = acallback_event;
   ink_debug_assert(ethread == this_ethread());
   ink_assert(atimeout_at > 0);
-  if (in_the_prot_queue)
-    ethread->EventQueueExternal.remove(this);
   if (in_the_priority_queue)
     ethread->EventQueue.remove(this);
   timeout_at = atimeout_at;
   period = 0;
   immediate = false;
   mutex = continuation->mutex;
-  ethread->EventQueueExternal.enqueue_local(this);
+  if (!in_the_prot_queue)
+    ethread->EventQueueExternal.enqueue_local(this);
 }
 
 void
@@ -70,15 +68,14 @@ Event::schedule_in(ink_hrtime atimeout_in, int acallback_event)
 {
   callback_event = acallback_event;
   ink_debug_assert(ethread == this_ethread());
-  if (in_the_prot_queue)
-    ethread->EventQueueExternal.remove(this);
   if (in_the_priority_queue)
     ethread->EventQueue.remove(this);
   timeout_at = ink_get_based_hrtime() + atimeout_in;
   period = 0;
   immediate = false;
   mutex = continuation->mutex;
-  ethread->EventQueueExternal.enqueue_local(this);
+  if (!in_the_prot_queue)
+    ethread->EventQueueExternal.enqueue_local(this);
 }
 
 void
@@ -87,8 +84,6 @@ Event::schedule_every(ink_hrtime aperiod, int acallback_event)
   callback_event = acallback_event;
   ink_debug_assert(ethread == this_ethread());
   ink_assert(aperiod != 0);
-  if (in_the_prot_queue)
-    ethread->EventQueueExternal.remove(this);
   if (in_the_priority_queue)
     ethread->EventQueue.remove(this);
   if (aperiod < 0) {
@@ -99,5 +94,6 @@ Event::schedule_every(ink_hrtime aperiod, int acallback_event)
   period = aperiod;
   immediate = false;
   mutex = continuation->mutex;
-  ethread->EventQueueExternal.enqueue_local(this);
+  if (!in_the_prot_queue)
+    ethread->EventQueueExternal.enqueue_local(this);
 }