blob: ecce1633ec6276c7a949613ca74785423b4f86be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
local llthreads = require"llthreads"
local utils = require "utils"
local sleep = utils.sleep
local include = utils.thread_init .. [[
local llthreads = require"llthreads"
local sleep = require "utils".sleep
]]
local thread = llthreads.new(include .. [[
sleep(5)
return 1,2,3
]])
assert(nil == thread:alive())
thread:start()
assert(true == thread:alive())
for i = 1, 10 do
if not thread:alive() then break end
sleep(1)
end
assert(false == thread:alive())
local ok,a,b,c = thread:join(0)
assert(ok == true)
assert(a == 1)
assert(b == 2)
assert(c == 3)
print("Done!")
|