1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-02 03:20:06 +00:00

IPC: Allow setting custom timeouts in disconnect

Also allows optionally ignoring callbacks during disconnect, so that the
call to `connectionLost` can be bypassed when disconnect is called from
the derived class destructor.
This commit is contained in:
reuk 2020-11-02 12:51:17 +00:00
parent 750c982c1d
commit a70101e3ec
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
2 changed files with 14 additions and 5 deletions

View file

@ -89,7 +89,7 @@ InterprocessConnection::~InterprocessConnection()
jassert (! safeAction->isSafe());
callbackConnectionState = false;
disconnect();
disconnect (4000, Notify::no);
thread.reset();
}
@ -145,7 +145,7 @@ bool InterprocessConnection::createPipe (const String& pipeName, int timeoutMs,
return false;
}
void InterprocessConnection::disconnect()
void InterprocessConnection::disconnect (int timeoutMs, Notify notify)
{
thread->signalThreadShouldExit();
@ -155,10 +155,13 @@ void InterprocessConnection::disconnect()
if (pipe != nullptr) pipe->close();
}
thread->stopThread (4000);
thread->stopThread (timeoutMs);
deletePipeAndSocket();
connectionLostInt();
if (notify == Notify::yes)
connectionLostInt();
callbackConnectionState = false;
safeAction->setSafe (false);
}