From 46a27a3f3a36365ee05d1d58c6d4f83f399274de Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Wed, 27 Apr 2022 16:38:41 -0400 Subject: [PATCH] check shutdown flag in worker loops so they don't lock up the exit process --- reactor-plc/startup.lua | 2 +- reactor-plc/threads.lua | 4 ++-- rtu/startup.lua | 2 +- rtu/threads.lua | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index 659c8a6..ae38449 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -12,7 +12,7 @@ os.loadAPI("config.lua") os.loadAPI("plc.lua") os.loadAPI("threads.lua") -local R_PLC_VERSION = "alpha-v0.4.3" +local R_PLC_VERSION = "alpha-v0.4.4" local print = util.print local println = util.println diff --git a/reactor-plc/threads.lua b/reactor-plc/threads.lua index ce17609..b774dbb 100644 --- a/reactor-plc/threads.lua +++ b/reactor-plc/threads.lua @@ -239,7 +239,7 @@ function thread__iss(smem) end -- check for messages in the message queue - while iss_queue.ready() do + while iss_queue.ready() and not plc_state.shutdown do local msg = iss_queue.pop() if msg.qtype == mqueue.TYPE.COMMAND then @@ -331,7 +331,7 @@ function thread__comms(smem) -- thread loop while true do -- check for messages in the message queue - while comms_queue.ready() do + while comms_queue.ready() and not plc_state.shutdown do local msg = comms_queue.pop() if msg.qtype == mqueue.TYPE.COMMAND then diff --git a/rtu/startup.lua b/rtu/startup.lua index be27048..8fea859 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -19,7 +19,7 @@ os.loadAPI("dev/boiler_rtu.lua") os.loadAPI("dev/imatrix_rtu.lua") os.loadAPI("dev/turbine_rtu.lua") -local RTU_VERSION = "alpha-v0.4.3" +local RTU_VERSION = "alpha-v0.4.4" local print = util.print local println = util.println diff --git a/rtu/threads.lua b/rtu/threads.lua index 692697d..c8abdd9 100644 --- a/rtu/threads.lua +++ b/rtu/threads.lua @@ -121,7 +121,7 @@ function thread__comms(smem) -- thread loop while true do -- check for messages in the message queue - while comms_queue.ready() do + while comms_queue.ready() and not plc_state.shutdown do local msg = comms_queue.pop() if msg.qtype == mqueue.TYPE.COMMAND then