]> git.ipfire.org Git - thirdparty/squid.git/blob - src/Instance.h
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / Instance.h
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_INSTANCE_H
10 #define SQUID_INSTANCE_H
11
12 #if HAVE_SYS_TYPES_H
13 #include <sys/types.h>
14 #endif
15
16 /// code related to Squid Instance and PID file management
17 namespace Instance {
18
19 /// Usually throws if another Squid instance is running. False positives are
20 /// highly unlikely, but the caller must tolerate false negatives well:
21 /// We may not detect another running instance and, hence, may not throw.
22 /// Does nothing if PID file maintenance is disabled.
23 void ThrowIfAlreadyRunning();
24
25 /// Creates or updates the PID file for the current process.
26 /// Does nothing if PID file maintenance is disabled.
27 void WriteOurPid();
28
29 /// \returns another Squid instance PID
30 /// Throws if PID file maintenance is disabled.
31 pid_t Other();
32
33 } // namespace Instance
34
35 #endif
36