diff --git a/doc/website/release-notes/iceoryx-unreleased.md b/doc/website/release-notes/iceoryx-unreleased.md index 8d6d2ba787..4cde701812 100644 --- a/doc/website/release-notes/iceoryx-unreleased.md +++ b/doc/website/release-notes/iceoryx-unreleased.md @@ -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) @@ -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 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 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(); + } + ``` diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/adaptive_wait.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/adaptive_wait.hpp index 694e173efc..17c4093792 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/adaptive_wait.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/adaptive_wait.hpp @@ -20,7 +20,6 @@ #include "iceoryx_hoofs/cxx/function_ref.hpp" #include "iceoryx_hoofs/internal/units/duration.hpp" -#include #include namespace iox diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/functional_interface.inl b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/functional_interface.inl index 3e5967cc68..eed508f15d 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/functional_interface.inl +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/functional_interface.inl @@ -37,7 +37,7 @@ inline void Expect::expect(const StringType& msg) const noexcept if (!(*static_cast(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); @@ -55,7 +55,7 @@ inline ValueType& ExpectWithValue::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); diff --git a/iceoryx_hoofs/test/moduletests/test_cxx_adaptive_wait.cpp b/iceoryx_hoofs/test/moduletests/test_cxx_adaptive_wait.cpp index bb67c6b751..9c6d8018d6 100644 --- a/iceoryx_hoofs/test/moduletests/test_cxx_adaptive_wait.cpp +++ b/iceoryx_hoofs/test/moduletests/test_cxx_adaptive_wait.cpp @@ -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