From c40ead14c691d6da429fdfe515ccc0f099d284aa Mon Sep 17 00:00:00 2001 From: "Killat Matthias (CC-AD/ESW1)" Date: Mon, 14 Sep 2020 15:59:43 +0200 Subject: [PATCH] iox #243 added deprecated comment to timer Signed-off-by: Killat Matthias (CC-AD/ESW1) --- .../include/iceoryx_utils/posix_wrapper/timer.hpp | 9 +++++++++ iceoryx_utils/source/posix_wrapper/timer.cpp | 6 +----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/iceoryx_utils/include/iceoryx_utils/posix_wrapper/timer.hpp b/iceoryx_utils/include/iceoryx_utils/posix_wrapper/timer.hpp index c6090e4141..0792a45ba5 100644 --- a/iceoryx_utils/include/iceoryx_utils/posix_wrapper/timer.hpp +++ b/iceoryx_utils/include/iceoryx_utils/posix_wrapper/timer.hpp @@ -67,6 +67,14 @@ using namespace iox::units::duration_literals; /// TiborTheTimer.stop(); /// /// @endcode + +/// This class will be DEPRECATED in the near future. In its current form there may still be potential races when +/// start/stop/restart are called concurrently (this includes the callback, which is executed in a separate thread). +/// The implementation also has too much overhead in the callback execution (due to execution logic and potentially +/// multiple callback threads). +/// +/// It will be replaced with simpler versions for individual use cases, such as a CountdownTimer which can be used for +/// watchdog/keepalive purposes. class Timer { public: @@ -122,6 +130,7 @@ class Timer OsTimer* m_timer{nullptr}; }; + /// This class will be DEPRECATED in the near future. class OsTimer { #ifdef __QNX__ diff --git a/iceoryx_utils/source/posix_wrapper/timer.cpp b/iceoryx_utils/source/posix_wrapper/timer.cpp index d0c5c9d557..bea882685a 100644 --- a/iceoryx_utils/source/posix_wrapper/timer.cpp +++ b/iceoryx_utils/source/posix_wrapper/timer.cpp @@ -268,11 +268,7 @@ Timer::OsTimer::~OsTimer() noexcept m_timerId = INVALID_TIMER_ID; - // note that some of those relaxed loads and stores could be potential problems since they might - // be reordered within certain constraints which may lead to subtle but serious logical errors due to races - // (especially on architectures with weaker memory model) - // this cannot be fixed without detailed analysis and a redesign is advised - callbackHandle.m_inUse.store(false, std::memory_order_relaxed); + callbackHandle.m_inUse.store(false, std::memory_order_seq_cst); } }