From 71be6aca1a09400688e218f5973a71bede67143b Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Wed, 27 Apr 2022 12:43:32 -0400 Subject: [PATCH] cleanup and last_update bugfix for comms thread --- reactor-plc/threads.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/reactor-plc/threads.lua b/reactor-plc/threads.lua index ec0d267..f4375c9 100644 --- a/reactor-plc/threads.lua +++ b/reactor-plc/threads.lua @@ -286,7 +286,7 @@ function thread__iss(smem) end end log._warning("iss thread exiting") - return + break end -- debug @@ -305,6 +305,7 @@ function thread__iss(smem) return { exec = exec } end +-- communications handler thread function thread__comms(smem) -- execute thread local exec = function () @@ -314,10 +315,10 @@ function thread__comms(smem) local comms_queue = smem.q.mq_comms + local last_update = util.time() + -- thread loop while true do - local last_update = util.time() - -- check for messages in the message queue while comms_queue.ready() do local msg = comms_queue.pop() @@ -344,7 +345,7 @@ function thread__comms(smem) -- check for termination request if plc_state.shutdown then log._warning("comms thread exiting") - return + break end -- delay before next check