|
33 | 33 | using namespace llvm;
|
34 | 34 | using namespace llvm::orc;
|
35 | 35 |
|
36 |
| -static std::atomic<pid_t> LaunchedExecutorPID{-1}; |
| 36 | +static std::vector<pid_t> LaunchedExecutorPID; |
37 | 37 |
|
38 | 38 | Expected<uint64_t> getSlabAllocSize(StringRef SizeString) {
|
39 | 39 | SizeString = SizeString.trim();
|
@@ -93,7 +93,8 @@ createSharedMemoryManager(SimpleRemoteEPC &SREPC,
|
93 | 93 |
|
94 | 94 | Expected<std::unique_ptr<SimpleRemoteEPC>>
|
95 | 95 | launchExecutor(StringRef ExecutablePath, bool UseSharedMemory,
|
96 |
| - llvm::StringRef SlabAllocateSizeString, int stdin_fd, int stdout_fd, int stderr_fd) { |
| 96 | + llvm::StringRef SlabAllocateSizeString, int stdin_fd, |
| 97 | + int stdout_fd, int stderr_fd) { |
97 | 98 | #ifndef LLVM_ON_UNIX
|
98 | 99 | // FIXME: Add support for Windows.
|
99 | 100 | return make_error<StringError>("-" + ExecutablePath +
|
@@ -175,7 +176,7 @@ launchExecutor(StringRef ExecutablePath, bool UseSharedMemory,
|
175 | 176 | exit(1);
|
176 | 177 | }
|
177 | 178 | } else {
|
178 |
| - LaunchedExecutorPID = ChildPID; |
| 179 | + LaunchedExecutorPID.push_back(ChildPID); |
179 | 180 | }
|
180 | 181 | // else we're the parent...
|
181 | 182 |
|
@@ -287,6 +288,12 @@ connectTCPSocket(StringRef NetworkAddress, bool UseSharedMemory,
|
287 | 288 | #endif
|
288 | 289 | }
|
289 | 290 |
|
290 |
| -pid_t getLastLaunchedExecutorPID() { |
291 |
| - return LaunchedExecutorPID; |
| 291 | +pid_t getLastLaunchedExecutorPID() { |
| 292 | + if(!LaunchedExecutorPID.size()) return -1; |
| 293 | + return LaunchedExecutorPID.back(); |
| 294 | +} |
| 295 | + |
| 296 | +pid_t getNthLaunchedExecutorPID(int n) { |
| 297 | + if (n - 1 < 0 || n - 1 >= static_cast<int>(LaunchedExecutorPID.size())) return -1; |
| 298 | + return LaunchedExecutorPID.at(n - 1); |
292 | 299 | }
|
0 commit comments