RunnersRegistry.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2021 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 
A RegisteredRunner with lifetime determined by forces outside the Registry.
void unregisterRunner()
unregisters self; safe to call multiple times
bool UseThisStatic(const void *)
convenience function to "use" an otherwise unreferenced static variable
virtual void startReconfigure()
virtual void syncConfig()
virtual ~RegisteredRunner()
bool RegisterRunner(RegisteredRunner *rr)
registers a given runner with the given registry and returns true on success
virtual void endingShutdown()
virtual void useConfig()
virtual void finalizeConfig()
virtual void finishShutdown()
Meant for cleanup of services needed by the already destroyed objects.
virtual ~IndependentRunner()
virtual void claimMemoryNeeds()
virtual void startShutdown()
void RunRegistered(const RegisteredRunner::Method &m)
void(RegisteredRunner::* Method)()
a pointer to one of the above notification methods

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors