RunnersRegistry.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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
38{
39public:
40 /* Related methods below are declared in their calling order */
41
42 /* Configuration events */
43
46 virtual void bootstrapConfig() {}
47
51 virtual void finalizeConfig() {}
52
55 virtual void claimMemoryNeeds() {}
56
60 virtual void useConfig() {}
61
62 /* Reconfiguration events */
63
67 virtual void startReconfigure() {}
68
71 virtual void syncConfig() {}
72
73 /* Shutdown events */
74
78 virtual void startShutdown() {}
79
84 virtual void endingShutdown() {}
85
88 virtual ~RegisteredRunner() {}
89
91 virtual void finishShutdown() {}
92
94 typedef void (RegisteredRunner::*Method)();
95
96};
97
100
104
107{
108public:
110
111protected:
112 void registerRunner();
113 void unregisterRunner();
114};
115
117#define RunRegisteredHere(m) \
118 debugs(1, 2, "running " # m); \
119 RunRegistered(&m)
120
122bool UseThisStatic(const void *);
123
125#define RunnerRegistrationEntry(Who) \
126 static const bool Who ## _Registered_ = \
127 RegisterRunner(new Who) > 0 && \
128 UseThisStatic(& Who ## _Registered_);
129
130#endif /* SQUID_BASE_RUNNERSREGISTRY_H */
131
void RunRegistered(const RegisteredRunner::Method &m)
bool UseThisStatic(const void *)
convenience function to "use" an otherwise unreferenced static variable
bool RegisterRunner(RegisteredRunner *rr)
registers a given runner with the given registry and returns true on success
A RegisteredRunner with lifetime determined by forces outside the Registry.
virtual ~IndependentRunner()
void unregisterRunner()
unregisters self; safe to call multiple times
virtual void syncConfig()
virtual void bootstrapConfig()
virtual void claimMemoryNeeds()
void(RegisteredRunner::* Method)()
a pointer to one of the above notification methods
virtual void startShutdown()
virtual ~RegisteredRunner()
virtual void finalizeConfig()
virtual void endingShutdown()
virtual void finishShutdown()
Meant for cleanup of services needed by the already destroyed objects.
virtual void useConfig()
virtual void startReconfigure()

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors