Browse Source

ConnectedChildProcess: Wait for process termination on Linux to not leave zombies

This change also avoids the AudioPluginHost leaving zombie child
processes behind.
v7.0.12
attila 1 year ago
parent
commit
cc60286c89
2 changed files with 14 additions and 3 deletions
  1. +13
    -2
      modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp
  2. +1
    -1
      modules/juce_events/interprocess/juce_ConnectedChildProcess.h

+ 13
- 2
modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp View File

@@ -164,9 +164,20 @@ bool ChildProcessCoordinator::launchWorkerProcess (const File& executable, const
args.add (executable.getFullPathName());
args.add (getCommandLinePrefix (commandLineUniqueID) + pipeName);
childProcess.reset (new ChildProcess());
childProcess = [&]() -> std::shared_ptr<ChildProcess>
{
if ((SystemStats::getOperatingSystemType() & SystemStats::Linux) != 0)
return ChildProcessManager::getInstance()->createAndStartManagedChildProcess (args, streamFlags);
auto p = std::make_shared<ChildProcess>();
if (p->start (args, streamFlags))
return p;
return nullptr;
}();
if (childProcess->start (args, streamFlags))
if (childProcess != nullptr)
{
connection.reset (new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs));


+ 1
- 1
modules/juce_events/interprocess/juce_ConnectedChildProcess.h View File

@@ -215,7 +215,7 @@ public:
bool sendMessageToSlave (const MemoryBlock& mb) { return sendMessageToWorker (mb); }
private:
std::unique_ptr<ChildProcess> childProcess;
std::shared_ptr<ChildProcess> childProcess;
struct Connection;
std::unique_ptr<Connection> connection;


Loading…
Cancel
Save