34 createdPipe (createPipe)
64 const auto pipe = pipeIn.get();
71 const auto error =
errno;
96 if (
pipe == invalidPipe)
108 const auto error =
errno;
136 createdFifoOut = createFifo (pipeOutName,
mustNotExist);
138 return createdFifoIn && createdFifoOut;
141 static constexpr auto invalidPipe = -1;
146 template <
typename Fn>
152 if (descriptor != invalidPipe)
157 return descriptor = fn();
165 if (descriptor == invalidPipe)
170 ::close (descriptor);
171 descriptor = invalidPipe;
182 int descriptor = invalidPipe;
185 const String pipeInName, pipeOutName;
187 bool createdFifoIn =
false, createdFifoOut =
false;
189 const bool createdPipe;
193 static void signalHandler (
int) {}
209 auto p = ::open (name.toUTF8(), flags);
211 if (p != invalidPipe || hasExpired (
timeoutEnd) || stopReadOperation.
load())
220 auto&
pipe = isInput ? pipeIn : pipeOut;
223 const String&
pipeName = isInput ? (createdPipe ? pipeInName : pipeOutName)
224 : (createdPipe ? pipeOutName : pipeInName);
232 static void waitForInput (
int handle,
int timeoutMsecs)
noexcept
238 static void waitToWrite (
int handle,
int timeoutMsecs)
noexcept
252 if (pimpl !=
nullptr)
254 pimpl->stopReadOperation =
true;
256 const char buffer[] { 0 };
278 pimpl.
reset (
new Pimpl (file, createPipe));
287 if (! pimpl->connect (200))
static bool isAbsolutePath(StringRef path)
Returns true if the string seems to be a fully-specified absolute path.
@ tempDirectory
The folder that should be used for temporary files.
static File JUCE_CALLTYPE getSpecialLocation(const SpecialLocationType type)
Finds the location of a special type of file or directory, such as a home folder or documents folder.
static String createLegalFileName(const String &fileNameToFix)
Returns a version of a filename with any illegal characters removed.
int write(const void *sourceBuffer, int numBytesToWrite, int timeOutMilliseconds)
Writes some data to the pipe.
int read(void *destBuffer, int maxBytesToRead, int timeOutMilliseconds)
Reads data from the pipe.
void close()
Closes the pipe, if it's open.
A critical section that allows multiple simultaneous readers.
Automatically locks and unlocks a ReadWriteLock object.
Automatically locks and unlocks a ReadWriteLock object.
CharPointer_UTF8 toUTF8() const
Returns a pointer to a UTF-8 version of this string.
static void JUCE_CALLTYPE sleep(int milliseconds)
Suspends the execution of the current thread until the specified timeout period has elapsed (note tha...
static uint32 getMillisecondCounter() noexcept
Returns the number of millisecs since a fixed event (usually system startup).
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
unsigned int uint32
A platform-independent 32-bit unsigned integer type.
constexpr int numElementsInArray(Type(&)[N]) noexcept
Handy function for getting the number of elements in a simple const C array.