mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-02 03:20:06 +00:00
IPC: Fix potential deadlock in win32 NamedPipe implementation
We use a manual-reset event rather than an auto-reset event to cancel IO on the pipe. This avoids unlucky cases where new IO would start just after signalling the event and would block indefinitely while waiting on the newly-unsignalled event.
This commit is contained in:
parent
c5136d28b7
commit
5a19a7c8e8
1 changed files with 2 additions and 2 deletions
|
|
@ -975,7 +975,7 @@ public:
|
|||
Pimpl (const String& pipeName, const bool createPipe, bool mustNotExist)
|
||||
: filename ("\\\\.\\pipe\\" + File::createLegalFileName (pipeName)),
|
||||
pipeH (INVALID_HANDLE_VALUE),
|
||||
cancelEvent (CreateEvent (nullptr, FALSE, FALSE, nullptr)),
|
||||
cancelEvent (CreateEvent (nullptr, TRUE, FALSE, nullptr)),
|
||||
connected (false), ownsPipe (createPipe), shouldStop (false)
|
||||
{
|
||||
if (createPipe)
|
||||
|
|
@ -1157,7 +1157,7 @@ private:
|
|||
}
|
||||
|
||||
HANDLE handles[] = { over.over.hEvent, cancelEvent };
|
||||
DWORD waitResult = WaitForMultipleObjects (2, handles, FALSE,
|
||||
DWORD waitResult = WaitForMultipleObjects (numElementsInArray (handles), handles, FALSE,
|
||||
timeOutMilliseconds >= 0 ? (DWORD) timeOutMilliseconds
|
||||
: INFINITE);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue