Browse Source

IPC: Avoid deadlocks when destroying pipes

Previously, calls to `open` blocked when creating a writeable pipe.

This could cause other calls to block indefinitely, waiting for the pipe
to become available.

Now, we open the pipe in nonblocking mode, which allows us to retry
indefinitely, checking `stopReadOperation` each time to find out whether
`close` has been called and allowing a graceful exit.
tags/2021-05-28
reuk 4 years ago
parent
commit
84be2fea9a
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      modules/juce_core/native/juce_posix_NamedPipe.cpp

+ 1
- 1
modules/juce_core/native/juce_posix_NamedPipe.cpp View File

@@ -154,7 +154,7 @@ private:
bool openPipe (bool isInput, uint32 timeoutEnd)
{
auto& pipe = isInput ? pipeIn : pipeOut;
int flags = isInput ? O_RDWR | O_NONBLOCK : O_WRONLY;
int flags = (isInput ? O_RDWR : O_WRONLY) | O_NONBLOCK;
const String& pipeName = isInput ? (createdPipe ? pipeInName : pipeOutName)
: (createdPipe ? pipeOutName : pipeInName);


Loading…
Cancel
Save