From b2bcf98cfc2b4804b0ac469bd239f7ec44af92cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Mon, 7 Sep 2026 16:59:19 +0200 Subject: [PATCH] cleanup: remove dead mutexes, properly take lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marius Börschig --- SilKit/source/services/orchestration/LifecycleService.hpp | 1 - SilKit/source/services/orchestration/TimeSyncService.hpp | 1 - SilKit/source/tracing/PcapSink.cpp | 6 +++++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/SilKit/source/services/orchestration/LifecycleService.hpp b/SilKit/source/services/orchestration/LifecycleService.hpp index 7390c2afd..8b7d2087a 100644 --- a/SilKit/source/services/orchestration/LifecycleService.hpp +++ b/SilKit/source/services/orchestration/LifecycleService.hpp @@ -148,7 +148,6 @@ class LifecycleService std::atomic _timeSyncActive{false}; // Final State Handling - std::mutex _finalStatePromiseMutex; std::unique_ptr> _finalStatePromise; std::future _finalStateFuture; diff --git a/SilKit/source/services/orchestration/TimeSyncService.hpp b/SilKit/source/services/orchestration/TimeSyncService.hpp index 2d87cb2d7..e62bb31e4 100644 --- a/SilKit/source/services/orchestration/TimeSyncService.hpp +++ b/SilKit/source/services/orchestration/TimeSyncService.hpp @@ -159,7 +159,6 @@ class TimeSyncService WatchDog _watchDog; bool _isCoupledToWallClock{false}; std::thread _wallClockCouplingThread; - mutable std::mutex _mx; std::atomic _currentWallClockSyncPointNs{0}; double _animationFactor{0}; std::atomic _wallClockCouplingThreadRunning{false}; diff --git a/SilKit/source/tracing/PcapSink.cpp b/SilKit/source/tracing/PcapSink.cpp index 98bd2fef3..ba39fa228 100644 --- a/SilKit/source/tracing/PcapSink.cpp +++ b/SilKit/source/tracing/PcapSink.cpp @@ -40,6 +40,8 @@ void PcapSink::Open(SinkType outputType, const std::string& outputPath) throw SilKitError("PcapSink::Open: outputPath must not be empty!"); } + std::unique_lock lock{_lock}; + switch (outputType) { case SilKit::SinkType::PcapFile: @@ -73,6 +75,8 @@ auto PcapSink::Name() const -> const std::string& void PcapSink::Close() { + std::unique_lock lock{_lock}; + if (_file) { _file.flush(); @@ -107,7 +111,7 @@ void PcapSink::Trace(SilKit::Services::TransmitDirection /*unused*/, } const auto& message = traceMessage.Get(); - std::unique_lock lock; + std::unique_lock lock{_lock}; const auto tosec = 1000'000ull; const auto usec = std::chrono::duration_cast(timestamp);