]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/Kids.h
SMP support, part 1: Essential non-caching functionality.
[thirdparty/squid.git] / src / ipc / Kids.h
1 /*
2 * $Id$
3 *
4 */
5
6 #ifndef SQUID_IPC_KIDS_H
7 #define SQUID_IPC_KIDS_H
8
9 #include "Array.h"
10 #include "ipc/Kid.h"
11
12
13 /// a collection of kids
14 class Kids
15 {
16 public:
17 Kids ();
18
19 private:
20 Kids (const Kids&); ///< not implemented
21 Kids& operator= (const Kids&); ///< not implemented
22
23 public:
24 /// maintain n kids
25 void init(size_t n);
26
27 /// returns kid by pid
28 Kid* find(pid_t pid);
29
30 /// returns the kid by index, useful for kids iteration
31 Kid& get(size_t i);
32
33 /// whether all kids are hopeless
34 bool allHopeless() const;
35
36 /// whether all kids called exited happy
37 bool allExitedHappy() const;
38
39 /// whether all kids died from a given signal
40 bool allSignaled(int sgnl) const;
41
42 /// returns the number of kids
43 size_t count() const;
44
45 private:
46 Vector<Kid> storage;
47 };
48
49 extern Kids TheKids; ///< All kids being maintained
50
51 extern char KidName[NAME_MAX]; ///< current Squid process name (e.g., squid2)
52 extern int KidIdentifier; ///< current Squid process number (e.g., 4)
53
54
55 #endif /* SQUID_IPC_KIDS_H */