From f14fddca16de7249b99194e464749ecb14b5a75c Mon Sep 17 00:00:00 2001 From: Marika Lehmann Date: Thu, 20 Oct 2022 16:08:55 +0200 Subject: [PATCH] iox-#1614 Fix named_pipe changes, update documentation Signed-off-by: Marika Lehmann --- .../include/iceoryx_dust/posix_wrapper/named_pipe.hpp | 6 ++---- iceoryx_dust/source/posix_wrapper/named_pipe.cpp | 8 ++++---- iceoryx_hoofs/README.md | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/iceoryx_dust/include/iceoryx_dust/posix_wrapper/named_pipe.hpp b/iceoryx_dust/include/iceoryx_dust/posix_wrapper/named_pipe.hpp index 5145c957df..648b4398aa 100644 --- a/iceoryx_dust/include/iceoryx_dust/posix_wrapper/named_pipe.hpp +++ b/iceoryx_dust/include/iceoryx_dust/posix_wrapper/named_pipe.hpp @@ -142,16 +142,14 @@ class NamedPipe : public DesignPattern::Creation MessageQueue_t messages; private: - static constexpr uint64_t SEND_SEMAPHORE = 0U; - static constexpr uint64_t RECEIVE_SEMAPHORE = 1U; - static constexpr uint64_t INVALID_DATA = 0xBAADF00DAFFEDEAD; static constexpr uint64_t VALID_DATA = 0xBAD0FF1CEBEEFBEE; static constexpr units::Duration WAIT_FOR_INIT_TIMEOUT = units::Duration::fromSeconds(1); static constexpr units::Duration WAIT_FOR_INIT_SLEEP_TIME = units::Duration::fromMilliseconds(1); std::atomic initializationGuard{INVALID_DATA}; - containers::UninitializedArray, 2> semaphores; + cxx::optional m_sendSemaphore; + cxx::optional m_receiveSemaphore; }; diff --git a/iceoryx_dust/source/posix_wrapper/named_pipe.cpp b/iceoryx_dust/source/posix_wrapper/named_pipe.cpp index 47fa565797..006847fd04 100644 --- a/iceoryx_dust/source/posix_wrapper/named_pipe.cpp +++ b/iceoryx_dust/source/posix_wrapper/named_pipe.cpp @@ -341,7 +341,7 @@ NamedPipe::NamedPipeData::NamedPipeData(bool& isInitialized, UnnamedSemaphoreBuilder() .initialValue(maxMsgNumber) .isInterProcessCapable(true) - .create(semaphores[SEND_SEMAPHORE]) + .create(m_sendSemaphore) .or_else([&](auto) { signalError("send"); }); if (!isInitialized) @@ -352,7 +352,7 @@ NamedPipe::NamedPipeData::NamedPipeData(bool& isInitialized, UnnamedSemaphoreBuilder() .initialValue(0U) .isInterProcessCapable(true) - .create(semaphores[RECEIVE_SEMAPHORE]) + .create(m_receiveSemaphore) .or_else([&](auto) { signalError("receive"); }); if (!isInitialized) @@ -365,12 +365,12 @@ NamedPipe::NamedPipeData::NamedPipeData(bool& isInitialized, UnnamedSemaphore& NamedPipe::NamedPipeData::sendSemaphore() noexcept { - return *semaphores[SEND_SEMAPHORE]; + return *m_sendSemaphore; } UnnamedSemaphore& NamedPipe::NamedPipeData::receiveSemaphore() noexcept { - return *semaphores[RECEIVE_SEMAPHORE]; + return *m_receiveSemaphore; } bool NamedPipe::NamedPipeData::waitForInitialization() const noexcept diff --git a/iceoryx_hoofs/README.md b/iceoryx_hoofs/README.md index c7303ac07d..e48f8b1ce9 100644 --- a/iceoryx_hoofs/README.md +++ b/iceoryx_hoofs/README.md @@ -41,7 +41,7 @@ The module structure is a logical grouping. It is replicated for `concurrent` an |:---------------------:|:--------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |`vector` | | Heap and exception free implementation of `std::vector` | |`list` | | Heap and exception free, relocatable implementation of `std::list` | -|`UninitializedArray` | | Wrapper class for C-style array | +|`UninitializedArray` | | Wrapper class for an uninitialized C-style array which can be zeroed via a template parameter | ### Vocabulary types (vocabulary)