1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Plugin Scanning: Fix thread sanitizer issues in the AudioPluginHost

This commit is contained in:
reuk 2022-01-18 16:50:16 +00:00
parent 01e71bc351
commit 093dbc7df1
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
5 changed files with 109 additions and 48 deletions

View file

@ -51,6 +51,8 @@ struct ChildProcessPingThread : public Thread,
pingReceived();
}
void startPinging() { startThread (4); }
void pingReceived() noexcept { countdown = timeoutMs / 1000 + 1; }
void triggerConnectionLostMessage() { triggerAsyncUpdate(); }
@ -90,8 +92,7 @@ struct ChildProcessCoordinator::Connection : public InterprocessConnection,
ChildProcessPingThread (timeout),
owner (m)
{
if (createPipe (pipeName, timeoutMs))
startThread (4);
createPipe (pipeName, timeoutMs);
}
~Connection() override
@ -99,6 +100,8 @@ struct ChildProcessCoordinator::Connection : public InterprocessConnection,
stopThread (10000);
}
using ChildProcessPingThread::startPinging;
private:
void connectionMade() override {}
void connectionLost() override { owner.handleConnectionLost(); }
@ -198,7 +201,6 @@ struct ChildProcessWorker::Connection : public InterprocessConnection,
owner (p)
{
connectToPipe (pipeName, timeoutMs);
startThread (4);
}
~Connection() override
@ -207,6 +209,8 @@ struct ChildProcessWorker::Connection : public InterprocessConnection,
disconnect();
}
using ChildProcessPingThread::startPinging;
private:
ChildProcessWorker& owner;
@ -275,7 +279,9 @@ bool ChildProcessWorker::initialiseFromCommandLine (const String& commandLine,
{
connection.reset (new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs));
if (! connection->isConnected())
if (connection->isConnected())
connection->startPinging();
else
connection.reset();
}
}