blob: 79d576061e953ab316b752d6fa6d98b9e6841e48 (
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
|
local lanes = require "lanes".configure()
print("Name of table: ", lanes.nameof({}))
print("Name of string.sub: ", lanes.nameof(string.sub))
print("Name of print: ", lanes.nameof(print))
-- a standalone function without any dependency
local body = function()
local n = 0
for i = 1, 1e30 do
n = n + 1
end
end
-- start the lane without any library
local h = lanes.gen(nil, body)()
lanes.sleep(0.1)
print("Name of lane: ", lanes.nameof(h), "("..h.status..")")
assert(h.status == "running")
-- cancel the lane
h:cancel("line", 1)
lanes.sleep(0.1)
print("Name of lane: ", lanes.nameof(h), "("..h.status..")")
assert(h.status == "cancelled")
print "TEST OK"
|