LLVM: include/llvm/Support/LockFileManager.h Source File (original) (raw)
1
2
3
4
5
6
7
8#ifndef LLVM_SUPPORT_LOCKFILEMANAGER_H
9#define LLVM_SUPPORT_LOCKFILEMANAGER_H
10
12#include
13#include <system_error>
14#include
15
16namespace llvm {
17class StringRef;
18
19
20
21
22
23
24
25
26
28public:
29
31
32
34
35
37
38
41
42
44
46
48
51
52private:
56
57 std::optional<std::pair<std::string, int>> Owner;
58 std::error_code ErrorCode;
59 std::string ErrorDiagMsg;
60
63
64 static std::optional<std::pair<std::string, int>>
65 readLockFile(StringRef LockFileName);
66
67 static bool processStillExecuting(StringRef Hostname, int PID);
68
69public:
70
73
74
76
78
79
80
81
83
84
85
87
88
90
91
93 ErrorCode = EC;
94 ErrorDiagMsg = ErrorMsg.str();
95 }
96};
97
98}
99
100#endif
This file defines the SmallString class.
Class that manages the creation of a lock file to aid implicit coordination between different process...
LockFileState
Describes the state of a lock file.
@ LFS_Error
An error occurred while trying to create or find the lock file.
@ LFS_Owned
The lock file has been created and is owned by this instance of the object.
@ LFS_Shared
The lock file already exists and is owned by some other instance.
std::string getErrorMessage() const
Get error message, or "" if there is no error.
void setError(const std::error_code &EC, StringRef ErrorMsg="")
Set error and error message.
std::error_code unsafeRemoveLockFile()
Remove the lock file.
WaitForUnlockResult waitForUnlock(const unsigned MaxSeconds=90)
For a shared lock, wait until the owner releases the lock.
WaitForUnlockResult
Describes the result of waiting for the owner to release the lock.
@ Res_Success
The lock was released successfully.
@ Res_Timeout
Reached timeout while waiting for the owner to release the lock.
@ Res_OwnerDied
Owner died while holding the lock.
LockFileState getState() const
Determine the state of the lock file.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.