aboutsummaryrefslogtreecommitdiff
path: root/tests/units/thread-infinite.lua
blob: b3183f97dc74b0fc4cfe527112b9252a705fb3b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()