blob: 75586d6156cbb026ef1b04b9f91660cf5b22db96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import("core.thread.thread")
function callback(id)
print("%s: %d ..", thread.running(), id)
local dt = os.mclock()
os.sleep(1000)
dt = os.mclock() - dt
print("%s: %d end, dt: %d ms", thread.running(), id, dt)
end
function main()
for i = 1, 10 do
-- TODO use thread.start and group
thread.new(callback, {argv = {i}, name = "session_" .. i}):start()
end
--thread.wait()
end
|