Skip to content

Commit

Permalink
iox-eclipse-iceoryx#751 Add code examples and feature note to release…
Browse files Browse the repository at this point in the history
… notes

Signed-off-by: Christian Eltzschig <me@elchris.org>
  • Loading branch information
elfenpiff committed Jun 23, 2022
1 parent 42d1bde commit 1164205
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 3 deletions.
57 changes: 57 additions & 0 deletions doc/website/release-notes/iceoryx-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- Refactor semaphore [\#751](https://github.com/eclipse-iceoryx/iceoryx/issues/751)
- Introduce `UnnamedSemaphore`
- Introduce `NamedSemaphore`
- Remove old `Semaphore`
- Extend `concatenate`, `operator+`, `unsafe_append` and `append` of `iox::cxx::string` for chars [\#208](https://github.com/eclipse-iceoryx/iceoryx/issues/208)
- Extend `unsafe_append` and `append` methods of `iox::cxx::string` for `std::string` [\#208](https://github.com/eclipse-iceoryx/iceoryx/issues/208)
- The iceoryx development environment supports multiple running docker containers [\#1410](https://github.com/eclipse-iceoryx/iceoryx/issues/1410)
Expand Down Expand Up @@ -79,3 +80,59 @@
// after
#include "iceoryx_hoofs/design_pattern/builder.hpp"
```

3. Replace `Semaphore` with `NamedSemaphore` and `UnnamedSemaphore`

```cpp
// before
#include "iceoryx_hoofs/posix_wrapper/semaphore.hpp"

// named semaphore
auto semaphore = iox::posix::Semaphore::create(iox::posix::CreateNamedSemaphore,
"mySemaphoreName",
S_IRUSR | S_IWUSR,
0);

// unnamed semaphore
auto semaphore = iox::posix::Semaphore::create(iox::posix::CreateUnnamedSingleProcessSemaphore, 0);

// after
// named semaphore
#include "iceoryx_hoofs/posix_wrapper/named_semaphore.hpp"

iox::cxx::optional<iox::posix::NamedSemaphore> semaphore;
auto result = iox::posix::NamedSemaphoreBuilder()
.name("mySemaphoreName")
.openMode(iox::posix::OpenMode::OPEN_OR_CREATE)
.permissions(iox::cxx::perms::owner_all)
.initialValue(0U)
.create(semaphore);

// unnamed semaphore
#include "iceoryx_hoofs/posix_wrapper/unnamed_semaphore.hpp"

iox::cxx::optional<iox::posix::UnnamedSemaphore> semaphore;
auto result = iox::posix::UnnamedSemaphoreBuilder()
.initialValue(0U)
.isInterProcessCapable(true)
.create(semaphore);
```

4. `RoudiApp::waitForSignal` is deprecated
```cpp
// before
// in my custom roudi app implementation
uint8_t MyCustomRoudiApp::run() noexcept {
// ...

waitForSignal();
}

// after
// in my custom roudi app implementation
uint8_t MyCustomRoudiApp::run() noexcept {
// ...

iox::posix::waitForTerminationRequest();
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "iceoryx_hoofs/cxx/function_ref.hpp"
#include "iceoryx_hoofs/internal/units/duration.hpp"

#include <atomic>
#include <cstdint>

namespace iox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ inline void Expect<Derived>::expect(const StringType& msg) const noexcept

if (!(*static_cast<const Derived*>(this)))
{
// it is possible that expect is called inside an error handler therefore we
// it is possible that expect is called inside a signal handler therefore we
// use write
IOX_DISCARD_RESULT(write(STDERR_FILENO, &msg[0], strlen(&msg[0])));
Ensures(false);
Expand All @@ -55,7 +55,7 @@ inline ValueType& ExpectWithValue<Derived, ValueType>::expect(const StringType&

if (!(*derivedThis))
{
// it is possible that expect is called inside an error handler therefore we
// it is possible that expect is called inside a signal handler therefore we
// use write
IOX_DISCARD_RESULT(write(STDERR_FILENO, &msg[0], strlen(&msg[0])));
Ensures(false);
Expand Down
2 changes: 2 additions & 0 deletions iceoryx_hoofs/test/moduletests/test_cxx_adaptive_wait.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,7 @@ TEST(AdaptiveWaitTest, wait_loopWaitsAtLeastAsLongAsTheConditionsReturnsTrue)

EXPECT_THAT(std::chrono::nanoseconds(end - start).count(),
Ge(iox::units::Duration::fromMilliseconds(waitTime.count()).toNanoseconds()));

waitThread.join();
}
} // namespace

0 comments on commit 1164205

Please sign in to comment.