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:
parent
750c982c1d
commit
a70101e3ec
2 changed files with 14 additions and 5 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue