From ffa223b5b3edd217d06d659818dd40e14d8b9dec Mon Sep 17 00:00:00 2001 From: Alessandro Proto Date: Fri, 10 Feb 2023 20:24:28 +0100 Subject: [PATCH] Force queue processing end --- Capy64/Runtime/LuaState.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Capy64/Runtime/LuaState.cs b/Capy64/Runtime/LuaState.cs index 531792a..a0d3c83 100644 --- a/Capy64/Runtime/LuaState.cs +++ b/Capy64/Runtime/LuaState.cs @@ -79,12 +79,15 @@ public class LuaState : IDisposable /// Whether the thread can still be resumed and is not finished public bool ProcessQueue() { - while (Dequeue(out var npars)) + var ncycle = _queue.Count; + var done = 0; + while (done < ncycle && Dequeue(out var npars)) { if (!Resume(npars)) { return false; } + done++; } return true;