aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/atexit.lua45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/atexit.lua b/tests/atexit.lua
new file mode 100644
index 0000000..fb4f34a
--- /dev/null
+++ b/tests/atexit.lua
@@ -0,0 +1,45 @@
1require "lanes"
2
3-- create a free-running lane
4
5local linda = lanes.linda()
6
7local f = function( _linda)
8 _linda:receive("oy")
9end
10
11local g = function()
12 local cancelled
13 repeat
14 cancelled = cancel_test()
15 until cancelled
16 print "User cancellation detected!"
17end
18
19local genF = lanes.gen( "", {globals = {threadName = "mylane"}}, f)
20local genG = lanes.gen( "", g)
21
22
23-- launch a good batch of free running lanes
24for i = 1, 10 do
25 -- if i%50 == 0 then print( i) end
26 local h = genF( linda)
27 local status
28 repeat
29 status = h.status
30 --print( status)
31 until status == "waiting"
32
33 -- [[
34 local h = genG()
35 local status
36 repeat
37 status = h.status
38 --print( status)
39 until status == "running"
40 --]]
41end
42
43print "exiting"
44
45-- let process end terminate them and see what happens \ No newline at end of file