From 8f379980e9c9c8af16a7c0e406ca9513f2aceeef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eckel?= Date: Thu, 16 May 2024 15:28:03 +0200 Subject: [PATCH] termintationMutex became a sync.RWMutex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jürgen Eckel --- monitor/mqtt_monitor.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monitor/mqtt_monitor.go b/monitor/mqtt_monitor.go index 0d2a9b7..8cd71b6 100644 --- a/monitor/mqtt_monitor.go +++ b/monitor/mqtt_monitor.go @@ -28,7 +28,7 @@ type MqttMonitor struct { sdkContext *sdk.Context contextMutex sync.Mutex isTerminated bool - terminationMutex sync.Mutex + terminationMutex sync.RWMutex maxRetries time.Duration lostConnection bool lostConnectionMutex sync.Mutex @@ -43,9 +43,9 @@ func (mms *MqttMonitor) Terminate() { } func (mms *MqttMonitor) IsTerminated() (isTerminated bool) { - mms.terminationMutex.Lock() + mms.terminationMutex.RLock() isTerminated = mms.isTerminated - mms.terminationMutex.Unlock() + mms.terminationMutex.RUnlock() return }