Skip to content

Commit

Permalink
iox-eclipse-iceoryx#1614 Fix named_pipe changes, update documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Marika Lehmann <marika.lehmann@apex.ai>
  • Loading branch information
FerdinandSpitzschnueffler committed Nov 1, 2022
1 parent dd1a36f commit f14fddc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,14 @@ class NamedPipe : public DesignPattern::Creation<NamedPipe, IpcChannelError>
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<uint64_t> initializationGuard{INVALID_DATA};
containers::UninitializedArray<cxx::optional<UnnamedSemaphore>, 2> semaphores;
cxx::optional<UnnamedSemaphore> m_sendSemaphore;
cxx::optional<UnnamedSemaphore> m_receiveSemaphore;
};


Expand Down
8 changes: 4 additions & 4 deletions iceoryx_dust/source/posix_wrapper/named_pipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_hoofs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit f14fddc

Please sign in to comment.