]>
Commit | Line | Data |
---|---|---|
96c2bb61 | 1 | /* |
77b1029d | 2 | * Copyright (C) 1996-2020 The Squid Software Foundation and contributors |
bbc27441 AJ |
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. | |
96c2bb61 AR |
7 | */ |
8 | ||
9 | #ifndef SQUID_CPU_AFFINITY_SET_H | |
10 | #define SQUID_CPU_AFFINITY_SET_H | |
11 | ||
96c2bb61 AR |
12 | #include "compat/cpu.h" |
13 | ||
14 | /// cpu affinity management for a single process | |
15 | class CpuAffinitySet | |
16 | { | |
17 | public: | |
18 | CpuAffinitySet(); | |
19 | ||
20 | /// set CPU affinity for this process | |
21 | void apply(); | |
22 | ||
23 | /// undo CPU affinity changes for this process | |
24 | void undo(); | |
25 | ||
26 | /// whether apply() was called and was not undone | |
5ffe1090 | 27 | bool applied(); |
96c2bb61 AR |
28 | |
29 | /// set CPU affinity mask | |
30 | void set(const cpu_set_t &aCpuSet); | |
31 | ||
32 | private: | |
33 | cpu_set_t theCpuSet; ///< configured CPU affinity for this process | |
34 | cpu_set_t theOrigCpuSet; ///< CPU affinity for this process before apply() | |
35 | }; | |
36 | ||
37 | #endif // SQUID_CPU_AFFINITY_SET_H | |
f53969cc | 38 |