From 34fd386603bbc125c73cde433739a5675c678bed Mon Sep 17 00:00:00 2001 From: Christian Eltzschig Date: Thu, 23 Jun 2022 19:24:11 +0200 Subject: [PATCH] iox-#751 Replace adaptive_wait with Barrier Signed-off-by: Christian Eltzschig --- .../iceoryx_hoofs/posix_wrapper/named_pipe.hpp | 2 +- .../test_publisher_subscriber_communication.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/posix_wrapper/named_pipe.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/posix_wrapper/named_pipe.hpp index 72ba6e83c9..4d248e6a9b 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/posix_wrapper/named_pipe.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/posix_wrapper/named_pipe.hpp @@ -39,7 +39,7 @@ class NamedPipe : public DesignPattern::Creation static constexpr uint64_t MAX_MESSAGE_SIZE = 4U * 1024U; static constexpr uint32_t MAX_NUMBER_OF_MESSAGES = 10U; static_assert(MAX_NUMBER_OF_MESSAGES < IOX_SEM_VALUE_MAX, - "The maximum number of supported messages must be less to the maximum allowed semaphore value"); + "The maximum number of supported messages must be less than the maximum allowed semaphore value"); static constexpr uint64_t NULL_TERMINATOR_SIZE = 0U; static constexpr units::Duration CYCLE_TIME = units::Duration::fromMilliseconds(10); diff --git a/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp b/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp index 9176e1e742..9bd90f0f57 100644 --- a/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp +++ b/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp @@ -595,14 +595,14 @@ TEST_F(PublisherSubscriberCommunication_test, PublisherDoesNotBlockAndDiscardsSa EXPECT_FALSE(publisher->publishCopyOf("second hypnotoad ate it").has_error()); std::atomic_bool wasSampleDelivered{false}; - std::atomic_bool isThreadStarted{false}; + Barrier isThreadStarted(1U); std::thread t1([&] { - isThreadStarted = true; + isThreadStarted.notify(); EXPECT_FALSE(publisher->publishCopyOf("third a tiny black hole smells like butter").has_error()); wasSampleDelivered.store(true); }); - iox::cxx::internal::adaptive_wait().wait_loop([&] { return !isThreadStarted.load(); }); + isThreadStarted.wait(); t1.join(); EXPECT_TRUE(wasSampleDelivered.load()); @@ -665,16 +665,16 @@ TEST_F(PublisherSubscriberCommunication_test, MixedOptionsSetupWorksWithBlocking EXPECT_FALSE(publisherNonBlocking->publishCopyOf("hypnotoad has a sister named hypnoodle").has_error()); std::atomic_bool wasSampleDelivered{false}; - std::atomic_bool isThreadStarted{false}; + Barrier isThreadStarted(1U); std::thread t1([&] { - isThreadStarted = true; + isThreadStarted.notify(); EXPECT_FALSE(publisherBlocking->publishCopyOf("chucky is the only one who can ride the hypnotoad").has_error()); wasSampleDelivered.store(true); }); constexpr int64_t TIMEOUT_IN_MS = 100; - iox::cxx::internal::adaptive_wait().wait_loop([&] { return !isThreadStarted.load(); }); + isThreadStarted.wait(); std::this_thread::sleep_for(std::chrono::milliseconds(TIMEOUT_IN_MS)); EXPECT_FALSE(wasSampleDelivered.load());