diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/units/thread-infinite.lua | 23 |
1 files changed, 23 insertions, 0 deletions
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() |
