You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2012/12/12 06:24:36 UTC

[5/5] git commit: TS-1619: Add ConfigUpdateContinuation and ConfigScheduleUpdate helpers

TS-1619: Add ConfigUpdateContinuation and ConfigScheduleUpdate helpers


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

Branch: refs/heads/master
Commit: 7d2524ea1b5865e8005e138fa16e9d12df23ff87
Parents: bc8e101
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 11 20:48:10 2012 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 11 21:21:58 2012 -0800

----------------------------------------------------------------------
 mgmt/ProxyConfig.h |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d2524ea/mgmt/ProxyConfig.h
----------------------------------------------------------------------
diff --git a/mgmt/ProxyConfig.h b/mgmt/ProxyConfig.h
index 23e4bba..27e26d1 100644
--- a/mgmt/ProxyConfig.h
+++ b/mgmt/ProxyConfig.h
@@ -33,6 +33,9 @@
 
 #include "libts.h"
 #include "ProcessManager.h"
+#include "I_EventSystem.h"
+
+class ProxyMutex;
 
 void *config_int_cb(void *data, void *value);
 void *config_long_long_cb(void *data, void *value);
@@ -88,6 +91,28 @@ public:
   int ninfos;
 };
 
+// A Continuation wrapper that calls the static reconfigure() method of the given class.
+template <typename UpdateClass>
+struct ConfigUpdateContinuation : public Continuation
+{
+
+  int update(int /* etype */, void * /* data */) {
+    UpdateClass::reconfigure();
+    delete this;
+    return EVENT_DONE;
+  }
+
+  ConfigUpdateContinuation(ProxyMutex * m) : Continuation(m) {
+    SET_HANDLER(&ConfigUpdateContinuation::update);
+  }
+
+};
+
+template <typename UpdateClass> int
+ConfigScheduleUpdate(ProxyMutex * mutex) {
+  eventProcessor.schedule_imm(NEW(new ConfigUpdateContinuation<UpdateClass>(mutex)), ET_CALL);
+  return 0;
+}
 
 extern ConfigProcessor configProcessor;