From 04355ba2f0fbec85208bc807d3072828b19da293 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 2 Sep 2023 10:25:02 +0200 Subject: [PATCH] Rename a pipe method, add docs Signed-off-by: falkTX --- source/backend/CarlaUtils.h | 56 ++++++++++++++++++----------- source/backend/engine/CarlaEngineNative.cpp | 52 +++++++++++++-------------- source/backend/plugin/CarlaPluginLV2.cpp | 4 +-- source/backend/utils/PipeClient.cpp | 20 ++++++++--- source/includes/CarlaNativeExtUI.hpp | 2 +- source/native-plugins/midi-pattern.cpp | 2 +- source/utils/CarlaPipeUtils.cpp | 38 ++++++++++---------- source/utils/CarlaPipeUtils.hpp | 5 +-- 8 files changed, 104 insertions(+), 75 deletions(-) diff --git a/source/backend/CarlaUtils.h b/source/backend/CarlaUtils.h index 25af2e8fc..7fbc059ae 100644 --- a/source/backend/CarlaUtils.h +++ b/source/backend/CarlaUtils.h @@ -413,79 +413,95 @@ CARLA_PLUGIN_EXPORT void carla_juce_cleanup(void); /* -------------------------------------------------------------------------------------------------------------------- * pipes */ -/*! - * TODO. - */ typedef void* CarlaPipeClientHandle; /*! - * TODO. + * Callback for when a message has been received (in the context of carla_pipe_client_idle()). + * If extra data is required, use any of the carla_pipe_client_readlineblock* functions. */ typedef void (*CarlaPipeCallbackFunc)(void* ptr, const char* msg); /*! - * TODO. + * Create and connect to pipes as used by a server. + * @a argv must match the arguments set the by server. */ -CARLA_PLUGIN_EXPORT CarlaPipeClientHandle carla_pipe_client_new(const char* argv[], CarlaPipeCallbackFunc callbackFunc, void* callbackPtr); +CARLA_PLUGIN_EXPORT CarlaPipeClientHandle carla_pipe_client_new(const char* argv[], + CarlaPipeCallbackFunc callbackFunc, + void* callbackPtr); /*! - * TODO. + * Check the pipe for new messages and send them to the callback function. */ CARLA_PLUGIN_EXPORT void carla_pipe_client_idle(CarlaPipeClientHandle handle); /*! - * TODO. + * Check if the pipe is running. */ CARLA_PLUGIN_EXPORT bool carla_pipe_client_is_running(CarlaPipeClientHandle handle); /*! - * TODO. + * Lock the pipe write mutex. */ CARLA_PLUGIN_EXPORT void carla_pipe_client_lock(CarlaPipeClientHandle handle); /*! - * TODO. + * Unlock the pipe write mutex. */ CARLA_PLUGIN_EXPORT void carla_pipe_client_unlock(CarlaPipeClientHandle handle); /*! - * TODO. + * Read the next line as a string. */ CARLA_PLUGIN_EXPORT const char* carla_pipe_client_readlineblock(CarlaPipeClientHandle handle, uint timeout); /*! - * Extras. - * TODO. + * Read the next line as a boolean. */ CARLA_PLUGIN_EXPORT bool carla_pipe_client_readlineblock_bool(CarlaPipeClientHandle handle, uint timeout); + +/*! + * Read the next line as an integer. + */ CARLA_PLUGIN_EXPORT int carla_pipe_client_readlineblock_int(CarlaPipeClientHandle handle, uint timeout); + +/*! + * Read the next line as a floating point number (double precision). + */ CARLA_PLUGIN_EXPORT double carla_pipe_client_readlineblock_float(CarlaPipeClientHandle handle, uint timeout); /*! - * TODO. + * Write a valid message. + * A valid message has only one '\n' character and it's at the end. */ CARLA_PLUGIN_EXPORT bool carla_pipe_client_write_msg(CarlaPipeClientHandle handle, const char* msg); /*! - * TODO. + * Write and fix a message. */ CARLA_PLUGIN_EXPORT bool carla_pipe_client_write_and_fix_msg(CarlaPipeClientHandle handle, const char* msg); /*! - * TODO. + * Sync all messages currently in cache. + * This call will forcely write any messages in cache to any relevant IO. */ -CARLA_PLUGIN_EXPORT bool carla_pipe_client_flush(CarlaPipeClientHandle handle); +CARLA_PLUGIN_EXPORT bool carla_pipe_client_sync(CarlaPipeClientHandle handle); /*! - * TODO. + * Convenience call for doing both sync and unlock in one-go. */ -CARLA_PLUGIN_EXPORT bool carla_pipe_client_flush_and_unlock(CarlaPipeClientHandle handle); +CARLA_PLUGIN_EXPORT bool carla_pipe_client_sync_and_unlock(CarlaPipeClientHandle handle); /*! - * TODO. + * Destroy a previously created pipes instance. */ CARLA_PLUGIN_EXPORT void carla_pipe_client_destroy(CarlaPipeClientHandle handle); +/* DEPRECATED use carla_pipe_client_sync */ +CARLA_PLUGIN_EXPORT bool carla_pipe_client_flush(CarlaPipeClientHandle handle); + +/* DEPRECATED use carla_pipe_client_sync_and_unlock */ +CARLA_PLUGIN_EXPORT bool carla_pipe_client_flush_and_unlock(CarlaPipeClientHandle handle); + /* -------------------------------------------------------------------------------------------------------------------- * system stuff */ diff --git a/source/backend/engine/CarlaEngineNative.cpp b/source/backend/engine/CarlaEngineNative.cpp index 86b9dd27d..2547bb6ee 100644 --- a/source/backend/engine/CarlaEngineNative.cpp +++ b/source/backend/engine/CarlaEngineNative.cpp @@ -432,7 +432,7 @@ protected: std::snprintf(tmpBuf, STR_MAX, "%i\n", newBufferSize); if (fUiServer.writeMessage(tmpBuf)) - fUiServer.flushMessages(); + fUiServer.syncMessages(); } } #endif @@ -461,7 +461,7 @@ protected: } if (fUiServer.writeMessage(tmpBuf)) - fUiServer.flushMessages(); + fUiServer.syncMessages(); } } #endif @@ -550,7 +550,7 @@ protected: pluginId, plugin->getMidiInCount(), plugin->getMidiOutCount()); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); } void uiServerSendPluginParameters(const CarlaPluginPtr& plugin) @@ -571,7 +571,7 @@ protected: std::snprintf(tmpBuf, STR_MAX, "%.12g\n", static_cast(plugin->getInternalParameterValue(i))); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); } uint32_t ins, outs, count; @@ -640,7 +640,7 @@ protected: CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); } - fUiServer.flushMessages(); + fUiServer.syncMessages(); } void uiServerSendPluginPrograms(const CarlaPluginPtr& plugin) @@ -668,7 +668,7 @@ protected: } } - fUiServer.flushMessages(); + fUiServer.syncMessages(); count = plugin->getMidiProgramCount(); std::snprintf(tmpBuf, STR_MAX, "MIDI_PROGRAM_COUNT_%i:%i:%i\n", @@ -688,7 +688,7 @@ protected: CARLA_SAFE_ASSERT_RETURN(fUiServer.writeAndFixMessage(mpData.name),); } - fUiServer.flushMessages(); + fUiServer.syncMessages(); } void uiServerSendPluginProperties(const CarlaPluginPtr& plugin) @@ -719,7 +719,7 @@ protected: CARLA_SAFE_ASSERT_RETURN(fUiServer.writeAndFixMessage(customData.value),); } - fUiServer.flushMessages(); + fUiServer.syncMessages(); } void uiServerCallback(const EngineCallbackOpcode action, const uint pluginId, @@ -829,7 +829,7 @@ protected: CARLA_SAFE_ASSERT_RETURN(fUiServer.writeEmptyMessage(),); } - fUiServer.flushMessages(); + fUiServer.syncMessages(); } void uiServerInfo() @@ -863,7 +863,7 @@ protected: } CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); } void uiServerOptions() @@ -885,66 +885,66 @@ protected: CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(optionsForcedStr, optionsForcedStrSize),); std::snprintf(tmpBuf, STR_MAX, "%i\n", options.processMode); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); std::snprintf(tmpBuf, STR_MAX, "ENGINE_OPTION_%i\n", ENGINE_OPTION_TRANSPORT_MODE); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(optionsForcedStr, optionsForcedStrSize),); std::snprintf(tmpBuf, STR_MAX, "%i\n", options.transportMode); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); std::snprintf(tmpBuf, STR_MAX, "ENGINE_OPTION_%i\n", ENGINE_OPTION_FORCE_STEREO); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(optionsForcedStr, optionsForcedStrSize),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(options.forceStereo ? "true\n" : "false\n"),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); std::snprintf(tmpBuf, STR_MAX, "ENGINE_OPTION_%i\n", ENGINE_OPTION_PREFER_PLUGIN_BRIDGES); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(optionsForcedStr, optionsForcedStrSize),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(options.preferPluginBridges ? "true\n" : "false\n"),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); std::snprintf(tmpBuf, STR_MAX, "ENGINE_OPTION_%i\n", ENGINE_OPTION_PREFER_UI_BRIDGES); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(optionsForcedStr, optionsForcedStrSize),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(options.preferUiBridges ? "true\n" : "false\n"),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); std::snprintf(tmpBuf, STR_MAX, "ENGINE_OPTION_%i\n", ENGINE_OPTION_UIS_ALWAYS_ON_TOP); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(optionsForcedStr, optionsForcedStrSize),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(options.uisAlwaysOnTop ? "true\n" : "false\n"),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); std::snprintf(tmpBuf, STR_MAX, "ENGINE_OPTION_%i\n", ENGINE_OPTION_MAX_PARAMETERS); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(optionsForcedStr, optionsForcedStrSize),); std::snprintf(tmpBuf, STR_MAX, "%i\n", options.maxParameters); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); std::snprintf(tmpBuf, STR_MAX, "ENGINE_OPTION_%i\n", ENGINE_OPTION_UI_BRIDGES_TIMEOUT); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(optionsForcedStr, optionsForcedStrSize),); std::snprintf(tmpBuf, STR_MAX, "%i\n", options.uiBridgesTimeout); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); std::snprintf(tmpBuf, STR_MAX, "ENGINE_OPTION_%i\n", ENGINE_OPTION_PATH_BINARIES); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage("true\n", 5),); std::snprintf(tmpBuf, STR_MAX, "%s\n", options.binaryDir); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); std::snprintf(tmpBuf, STR_MAX, "ENGINE_OPTION_%i\n", ENGINE_OPTION_PATH_RESOURCES); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage("true\n", 5),); std::snprintf(tmpBuf, STR_MAX, "%s\n", options.resourceDir); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); } #endif @@ -1451,7 +1451,7 @@ protected: CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage("runtime-info\n"),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); if (const char* const projFolder = getCurrentProjectFolder()) { @@ -1461,7 +1461,7 @@ protected: fLastProjectFolder = projFolder; CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage("project-folder\n"),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeAndFixMessage(projFolder),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); } } @@ -1488,7 +1488,7 @@ protected: CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage("0.0\n"),); } - fUiServer.flushMessages(); + fUiServer.syncMessages(); // ------------------------------------------------------------------------------------------------------------ // send peaks and param outputs for all plugins @@ -1507,7 +1507,7 @@ protected: static_cast(plugData.peaks[3])); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); for (uint32_t j=0, count=plugin->getParameterCount(); j < count; ++j) { @@ -1519,7 +1519,7 @@ protected: std::snprintf(tmpBuf, STR_MAX, "%.12g\n", static_cast(plugin->getParameterValue(j))); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); - fUiServer.flushMessages(); + fUiServer.syncMessages(); } } } @@ -2398,7 +2398,7 @@ bool CarlaEngineNativeUI::msgReceived(const char* const msg) noexcept const CarlaMutexLocker cml(getPipeLock()); if (writeMessage("error\n", 6) && writeAndFixMessage(fEngine->getLastError())) - flushMessages(); + syncMessages(); } return true; diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index e43ea03bc..fcd2715bd 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -584,7 +584,7 @@ public: if (! writeAndFixMessage(title)) return; - flushMessages(); + syncMessages(); } protected: @@ -1946,7 +1946,7 @@ public: if (! fPipeServer.writeMessage("show\n", 5)) return; - fPipeServer.flushMessages(); + fPipeServer.syncMessages(); } #ifndef BUILD_BRIDGE diff --git a/source/backend/utils/PipeClient.cpp b/source/backend/utils/PipeClient.cpp index f925a3159..9d85bbf4b 100644 --- a/source/backend/utils/PipeClient.cpp +++ b/source/backend/utils/PipeClient.cpp @@ -182,19 +182,19 @@ bool carla_pipe_client_write_and_fix_msg(CarlaPipeClientHandle handle, const cha return ((ExposedCarlaPipeClient*)handle)->writeAndFixMessage(msg); } -bool carla_pipe_client_flush(CarlaPipeClientHandle handle) +bool carla_pipe_client_sync(CarlaPipeClientHandle handle) { CARLA_SAFE_ASSERT_RETURN(handle != nullptr, false); - return ((ExposedCarlaPipeClient*)handle)->flushMessages(); + return ((ExposedCarlaPipeClient*)handle)->syncMessages(); } -bool carla_pipe_client_flush_and_unlock(CarlaPipeClientHandle handle) +bool carla_pipe_client_sync_and_unlock(CarlaPipeClientHandle handle) { CARLA_SAFE_ASSERT_RETURN(handle != nullptr, false); ExposedCarlaPipeClient* const pipe = (ExposedCarlaPipeClient*)handle; - const bool ret = pipe->flushMessages(); + const bool ret = pipe->syncMessages(); pipe->unlockPipe(); return ret; } @@ -211,6 +211,18 @@ void carla_pipe_client_destroy(CarlaPipeClientHandle handle) // -------------------------------------------------------------------------------------------------------------------- +bool carla_pipe_client_flush(CarlaPipeClientHandle handle) +{ + return carla_pipe_client_sync(handle); +} + +bool carla_pipe_client_flush_and_unlock(CarlaPipeClientHandle handle) +{ + return carla_pipe_client_sync_and_unlock(handle); +} + +// -------------------------------------------------------------------------------------------------------------------- + #ifndef CARLA_PLUGIN_BUILD # include "CarlaPipeUtils.cpp" #endif diff --git a/source/includes/CarlaNativeExtUI.hpp b/source/includes/CarlaNativeExtUI.hpp index d4e8e1bc3..31f867397 100644 --- a/source/includes/CarlaNativeExtUI.hpp +++ b/source/includes/CarlaNativeExtUI.hpp @@ -139,7 +139,7 @@ protected: if (! writeAndFixMessage(uiName)) return; - flushMessages(); + syncMessages(); } bool uiMIDIEvent(const uint8_t size, const uint8_t data[]) override diff --git a/source/native-plugins/midi-pattern.cpp b/source/native-plugins/midi-pattern.cpp index df235015a..9bf65aa85 100644 --- a/source/native-plugins/midi-pattern.cpp +++ b/source/native-plugins/midi-pattern.cpp @@ -353,7 +353,7 @@ protected: CARLA_SAFE_ASSERT_RETURN(writeMessage(strBuf),); - flushMessages(); + syncMessages(); } } #endif diff --git a/source/utils/CarlaPipeUtils.cpp b/source/utils/CarlaPipeUtils.cpp index 44bfd8777..74ed66c95 100644 --- a/source/utils/CarlaPipeUtils.cpp +++ b/source/utils/CarlaPipeUtils.cpp @@ -959,7 +959,7 @@ bool CarlaPipeCommon::writeEmptyMessage() const noexcept return _writeMsgBuffer("\n", 1); } -bool CarlaPipeCommon::flushMessages() const noexcept +bool CarlaPipeCommon::syncMessages() const noexcept { CARLA_SAFE_ASSERT_RETURN(pData->pipeSend != INVALID_PIPE_VALUE, false); @@ -991,7 +991,7 @@ bool CarlaPipeCommon::writeErrorMessage(const char* const error) const noexcept if (! writeAndFixMessage(error)) return false; - flushMessages(); + syncMessages(); return true; } @@ -1021,7 +1021,7 @@ bool CarlaPipeCommon::writeControlMessage(const uint32_t index, const float valu if (! _writeMsgBuffer(tmpBuf, std::strlen(tmpBuf))) return false; - flushMessages(); + syncMessages(); return true; } @@ -1039,7 +1039,7 @@ bool CarlaPipeCommon::writeConfigureMessage(const char* const key, const char* c if (! writeAndFixMessage(value)) return false; - flushMessages(); + syncMessages(); return true; } @@ -1057,7 +1057,7 @@ bool CarlaPipeCommon::writeProgramMessage(const uint32_t index) const noexcept if (! _writeMsgBuffer(tmpBuf, std::strlen(tmpBuf))) return false; - flushMessages(); + syncMessages(); return true; } @@ -1083,7 +1083,7 @@ bool CarlaPipeCommon::writeProgramMessage(const uint8_t channel, const uint32_t if (! _writeMsgBuffer(tmpBuf, std::strlen(tmpBuf))) return false; - flushMessages(); + syncMessages(); return true; } @@ -1105,7 +1105,7 @@ bool CarlaPipeCommon::writeMidiProgramMessage(const uint32_t bank, const uint32_ if (! _writeMsgBuffer(tmpBuf, std::strlen(tmpBuf))) return false; - flushMessages(); + syncMessages(); return true; } @@ -1123,7 +1123,7 @@ bool CarlaPipeCommon::writeReloadProgramsMessage(const int32_t index) const noex if (! _writeMsgBuffer(tmpBuf, std::strlen(tmpBuf))) return false; - flushMessages(); + syncMessages(); return true; } @@ -1157,7 +1157,7 @@ bool CarlaPipeCommon::writeMidiNoteMessage(const bool onOff, const uint8_t chann if (! _writeMsgBuffer(tmpBuf, std::strlen(tmpBuf))) return false; - flushMessages(); + syncMessages(); return true; } @@ -1191,7 +1191,7 @@ bool CarlaPipeCommon::writeLv2AtomMessage(const uint32_t index, const LV2_Atom* if (! writeAndFixMessage(base64atom.buffer())) return false; - flushMessages(); + syncMessages(); return true; } @@ -1220,7 +1220,7 @@ bool CarlaPipeCommon::writeLv2ParameterMessage(const char* const uri, const floa if (! _writeMsgBuffer(tmpBuf, std::strlen(tmpBuf))) return false; - flushMessages(); + syncMessages(); return true; } @@ -1248,7 +1248,7 @@ bool CarlaPipeCommon::writeLv2UridMessage(const uint32_t urid, const char* const if (! writeAndFixMessage(uri)) return false; - flushMessages(); + syncMessages(); return true; } @@ -1778,7 +1778,7 @@ void CarlaPipeServer::stopPipeServer(const uint32_t timeOutMilliseconds) noexcep if (pData->pipeSend != INVALID_PIPE_VALUE && ! pData->pipeClosed) { if (_writeMsgBuffer("__carla-quit__\n", 15)) - flushMessages(); + syncMessages(); } waitForProcessToStopOrKillIt(pData->processInfo.hProcess, timeOutMilliseconds); @@ -1796,7 +1796,7 @@ void CarlaPipeServer::stopPipeServer(const uint32_t timeOutMilliseconds) noexcep if (pData->pipeSend != INVALID_PIPE_VALUE && ! pData->pipeClosed) { if (_writeMsgBuffer("__carla-quit__\n", 15)) - flushMessages(); + syncMessages(); } waitForChildToStopOrKillIt(pData->pid, timeOutMilliseconds); @@ -1847,7 +1847,7 @@ void CarlaPipeServer::writeShowMessage() const noexcept if (! _writeMsgBuffer("show\n", 5)) return; - flushMessages(); + syncMessages(); } void CarlaPipeServer::writeFocusMessage() const noexcept @@ -1857,7 +1857,7 @@ void CarlaPipeServer::writeFocusMessage() const noexcept if (! _writeMsgBuffer("focus\n", 6)) return; - flushMessages(); + syncMessages(); } void CarlaPipeServer::writeHideMessage() const noexcept @@ -1867,7 +1867,7 @@ void CarlaPipeServer::writeHideMessage() const noexcept if (! _writeMsgBuffer("show\n", 5)) return; - flushMessages(); + syncMessages(); } // ----------------------------------------------------------------------- @@ -1937,7 +1937,7 @@ bool CarlaPipeClient::initPipeClient(const char* argv[]) noexcept pData->clientClosingDown = false; if (writeMessage("\n", 1)) - flushMessages(); + syncMessages(); return true; } @@ -1977,7 +1977,7 @@ void CarlaPipeClient::writeExitingMessageAndWait() noexcept const CarlaMutexLocker cml(pData->writeLock); if (_writeMsgBuffer("exiting\n", 8)) - flushMessages(); + syncMessages(); } // NOTE: no more messages are handled after this point diff --git a/source/utils/CarlaPipeUtils.hpp b/source/utils/CarlaPipeUtils.hpp index 2bab2c624..03c463053 100644 --- a/source/utils/CarlaPipeUtils.hpp +++ b/source/utils/CarlaPipeUtils.hpp @@ -175,9 +175,10 @@ public: bool writeEmptyMessage() const noexcept; /*! - * Flush all messages currently in cache. + * Sync all messages currently in cache. + * This call will forcely write any messages in cache to any relevant IO. */ - bool flushMessages() const noexcept; + bool syncMessages() const noexcept; // ------------------------------------------------------------------- // write prepared messages, no lock or flush needed (done internally) -- 2.11.4.GIT