blob: ba10d3b2a1176066a761f1ff22f2f319f7799ffa (
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
36
37
38
39
40
41
42
43
44
45
|
local lanes = require "lanes" -- auto configure
-- create a free-running lane
local linda = lanes.linda()
local f = function( _linda)
_linda:receive("oy")
end
local g = function()
local cancelled
repeat
cancelled = cancel_test()
until cancelled
print "User cancellation detected!"
end
local genF = lanes.gen( "", {name = 'auto', globals = {threadName = "mylane"}}, f)
local genG = lanes.gen( "", { name = 'auto'}, g)
-- launch a good batch of free running lanes
for i = 1, 10 do
-- if i%50 == 0 then print( i) end
local h = genF( linda)
local status
repeat
status = h.status
--print( status)
until status == "waiting"
-- [[
local h = genG()
local status
repeat
status = h.status
--print( status)
until status == "running"
--]]
end
print "exiting"
-- let process end terminate them and see what happens
|