From a0e9b343216b2062134b86521a74286e10703015 Mon Sep 17 00:00:00 2001 From: ame Date: Fri, 14 Nov 2025 02:06:22 -0600 Subject: sleep and thread fixes --- tests/units/thread-infinite.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/units/thread-infinite.lua (limited to 'tests/units') diff --git a/tests/units/thread-infinite.lua b/tests/units/thread-infinite.lua new file mode 100644 index 0000000..b3183f9 --- /dev/null +++ b/tests/units/thread-infinite.lua @@ -0,0 +1,23 @@ +local pass = llby.thread.buffer(true) + +local th = llby.thread.async(function(res) + while true do + res:testclose() + end +end) + +local readyb = llby.thread.buffer(false) + +local th2 = llby.thread.async(function(res) + llby.thread.usleep(1000 * 1000) + if not readyb:get() then + pass:set(false) + th:kill() + end +end) + +th:close() +readyb:set(true) +th2:await() + +return pass:get() -- cgit v1.2.3