Browse Source

Allow to set pipe size

tags/1.9.7
falkTX 9 years ago
parent
commit
ed18c73409
2 changed files with 19 additions and 4 deletions
  1. +18
    -3
      source/utils/CarlaPipeUtils.cpp
  2. +1
    -1
      source/utils/CarlaPipeUtils.hpp

+ 18
- 3
source/utils/CarlaPipeUtils.cpp View File

@@ -1133,7 +1133,10 @@ uintptr_t CarlaPipeServer::getPID() const noexcept

// -----------------------------------------------------------------------

bool CarlaPipeServer::startPipeServer(const char* const filename, const char* const arg1, const char* const arg2) noexcept
bool CarlaPipeServer::startPipeServer(const char* const filename,
const char* const arg1,
const char* const arg2,
const int size) noexcept
{
CARLA_SAFE_ASSERT_RETURN(pData->pipeRecv == INVALID_PIPE_VALUE, false);
CARLA_SAFE_ASSERT_RETURN(pData->pipeSend == INVALID_PIPE_VALUE, false);
@@ -1326,10 +1329,22 @@ bool CarlaPipeServer::startPipeServer(const char* const filename, const char* co
pipeRecvServer = pipeSendServer = INVALID_PIPE_VALUE;

#ifndef CARLA_OS_WIN
int ret;

//----------------------------------------------------------------
// set non-block reading
// set size

int ret = 0;
if (size > 4096)
{
try {
::fcntl(pipeRecvClient, F_SETPIPE_SZ, size);
} catch (...) {
// non-fatal
}
}

//----------------------------------------------------------------
// set non-block reading

try {
ret = ::fcntl(pipeRecvClient, F_SETFL, ::fcntl(pipeRecvClient, F_GETFL) | O_NONBLOCK);


+ 1
- 1
source/utils/CarlaPipeUtils.hpp View File

@@ -259,7 +259,7 @@ public:
* Start the pipe server using @a filename with 2 arguments.
* @see fail()
*/
bool startPipeServer(const char* const filename, const char* const arg1, const char* const arg2) noexcept;
bool startPipeServer(const char* const filename, const char* const arg1, const char* const arg2, const int size = -1) noexcept;

/*!
* Stop the pipe server.


Loading…
Cancel
Save