RunnersRegistry.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_BASE_RUNNERSREGISTRY_H
10 #define SQUID_BASE_RUNNERSREGISTRY_H
11 
35 class RegisteredRunner
38 {
39 public:
40  /* Related methods below are declared in their calling order */
41 
42  /* Configuration events */
43 
47  virtual void finalizeConfig() {}
48 
51  virtual void claimMemoryNeeds() {}
52 
56  virtual void useConfig() {}
57 
58  /* Reconfiguration events */
59 
63  virtual void startReconfigure() {}
64 
67  virtual void syncConfig() {}
68 
69  /* Shutdown events */
70 
74  virtual void startShutdown() {}
75 
80  virtual void endingShutdown() {}
81 
84  virtual ~RegisteredRunner() {}
85 
87  virtual void finishShutdown() {}
88 
90  typedef void (RegisteredRunner::*Method)();
91 
92 };
93 
96 
100 
103 {
104 public:
106 
107 protected:
108  void registerRunner();
109  void unregisterRunner();
110 };
111 
113 #define RunRegisteredHere(m) \
114  debugs(1, 2, "running " # m); \
115  RunRegistered(&m)
116 
118 bool UseThisStatic(const void *);
119 
121 #define RunnerRegistrationEntry(Who) \
122  static const bool Who ## _Registered_ = \
123  RegisterRunner(new Who) > 0 && \
124  UseThisStatic(& Who ## _Registered_);
125 
126 #endif /* SQUID_BASE_RUNNERSREGISTRY_H */
127 
void RunRegistered(const RegisteredRunner::Method &event)
virtual void finalizeConfig()
virtual void finishShutdown()
Meant for cleanup of services needed by the already destroyed objects.
bool UseThisStatic(const void *)
convenience function to "use" an otherwise unreferenced static variable
virtual ~IndependentRunner()
virtual void useConfig()
bool RegisterRunner(RegisteredRunner *rr)
registers a given runner with the given registry and returns true on success
virtual ~RegisteredRunner()
void unregisterRunner()
unregisters self; safe to call multiple times
A RegisteredRunner with lifetime determined by forces outside the Registry.
virtual void endingShutdown()
virtual void startShutdown()
void(RegisteredRunner::* Method)()
a pointer to one of the above notification methods
virtual void claimMemoryNeeds()
virtual void syncConfig()
virtual void startReconfigure()

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors