aboutsummaryrefslogtreecommitdiff
path: root/tests/track_lanes.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/track_lanes.lua')
-rw-r--r--tests/track_lanes.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/track_lanes.lua b/tests/track_lanes.lua
index daaa94c..5ea9a4e 100644
--- a/tests/track_lanes.lua
+++ b/tests/track_lanes.lua
@@ -1,5 +1,9 @@
1local lanes = require "lanes" .configure{ with_timers = false, track_lanes = true} 1local lanes = require "lanes" .configure{ with_timers = false, track_lanes = true}
2local wait = lanes.sleep 2
3local SLEEP = function(...)
4 local k, v = lanes.sleep(...)
5 assert(k == nil and v == "timeout")
6end
3 7
4print "hello" 8print "hello"
5 9
@@ -43,7 +47,7 @@ g( "forever", 'indefinitely')
43g( "two_seconds", 2) 47g( "two_seconds", 2)
44 48
45-- give a bit of time to reach the linda waiting call 49-- give a bit of time to reach the linda waiting call
46wait( 0.1) 50SLEEP(0.1)
47 51
48-- list the known lanes (should be living lanes) 52-- list the known lanes (should be living lanes)
49local threads = track( "============= START", 2) 53local threads = track( "============= START", 2)
@@ -51,7 +55,7 @@ local threads = track( "============= START", 2)
51assert(threads[1].status == 'waiting' and threads[2].status == 'waiting') 55assert(threads[1].status == 'waiting' and threads[2].status == 'waiting')
52 56
53-- wait until "two_seconds has completed" 57-- wait until "two_seconds has completed"
54wait(2.1) 58SLEEP(2.1)
55 59
56local threads = track( "============= two_seconds dead", 2) 60local threads = track( "============= two_seconds dead", 2)
57-- two_seconds forever 61-- two_seconds forever
@@ -61,7 +65,7 @@ assert(threads[1].status == 'done' and threads[2].status == 'waiting')
61g( "two_seconds", 2) 65g( "two_seconds", 2)
62 66
63-- give a bit of time to reach the linda waiting call 67-- give a bit of time to reach the linda waiting call
64wait( 0.1) 68SLEEP( 0.1)
65 69
66-- list the known lanes 70-- list the known lanes
67-- unless garbage collector cleaned it, we should have 3 lanes 71-- unless garbage collector cleaned it, we should have 3 lanes