]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/base/RunnersRegistry.cc
2 #include "base/RunnersRegistry.h"
6 typedef std::list
<RegisteredRunner
*> Runners
;
7 typedef std::map
<RunnerRegistry
, Runners
*> Registries
;
9 /// all known registries
10 static Registries
*TheRegistries
= NULL
;
12 /// returns the requested runners list, initializing structures as needed
14 GetRunners(const RunnerRegistry
®istryId
)
17 TheRegistries
= new Registries
;
19 if (TheRegistries
->find(registryId
) == TheRegistries
->end())
20 (*TheRegistries
)[registryId
] = new Runners
;
22 return *(*TheRegistries
)[registryId
];
26 RegisterRunner(const RunnerRegistry
®istryId
, RegisteredRunner
*rr
)
28 Runners
&runners
= GetRunners(registryId
);
29 runners
.push_back(rr
);
30 return runners
.size();
34 ActivateRegistered(const RunnerRegistry
®istryId
)
36 Runners
&runners
= GetRunners(registryId
);
37 typedef Runners::iterator RRI
;
38 for (RRI i
= runners
.begin(); i
!= runners
.end(); ++i
)
39 (*i
)->run(registryId
);
40 return runners
.size();
44 DeactivateRegistered(const RunnerRegistry
®istryId
)
46 Runners
&runners
= GetRunners(registryId
);
47 while (!runners
.empty()) {
48 delete runners
.back();
54 UseThisStatic(const void *)