Skip to content

Commit a8cd548

Browse files
committed
Serial COM fix dead lock on connection error
Seen on macOS but might affect Linux too.
1 parent fb57429 commit a8cd548

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/zm_master_com_serial.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -776,20 +776,20 @@ static void SER_ProcessEvents()
776776
if (!plThread)
777777
return;
778778

779-
std::lock_guard<std::mutex> rx_lock(plThread->mtx_rx);
780-
781-
plThread->events &= ~TH0_EVENT_ID;
782-
783-
if (plThread->events == 0)
784-
return;
785-
786779
if (plThread->events & ERR_EVENT_ID)
787780
{
788781
Com->close();
789782
plThread->events = 0;
790783
return;
791784
}
792785

786+
std::lock_guard<std::mutex> rx_lock(plThread->mtx_rx);
787+
788+
plThread->events &= ~TH0_EVENT_ID;
789+
790+
if (plThread->events == 0)
791+
return;
792+
793793
if (plThread->events & RX_EVENT_ID)
794794
{
795795
PL_Poll();

0 commit comments

Comments
 (0)