aboutsummaryrefslogtreecommitdiff
path: root/tests/protect_allocator.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/protect_allocator.lua')
-rw-r--r--tests/protect_allocator.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/protect_allocator.lua b/tests/protect_allocator.lua
index 5cbb1d8..994cb39 100644
--- a/tests/protect_allocator.lua
+++ b/tests/protect_allocator.lua
@@ -2,6 +2,11 @@ local print = print
2 2
3local lanes = require "lanes".configure{ with_timers = false, allocator="protected"} 3local lanes = require "lanes".configure{ with_timers = false, allocator="protected"}
4 4
5local SLEEP = function(...)
6 local k, v = lanes.sleep(...)
7 assert(k == nil and v == "timeout")
8end
9
5local linda = lanes.linda() 10local linda = lanes.linda()
6 11
7local body = function( id_) 12local body = function( id_)
@@ -38,7 +43,7 @@ end
38 43
39-- wait a bit 44-- wait a bit
40print "waiting a bit ..." 45print "waiting a bit ..."
41linda:receive( 2, "foo") 46SLEEP(2)
42-- tell lanes to start running 47-- tell lanes to start running
43print "GO!" 48print "GO!"
44for i = 1, COUNT do 49for i = 1, COUNT do
@@ -49,5 +54,5 @@ end
49print "wait for completion" 54print "wait for completion"
50linda:receive( linda.batched, "key", COUNT) 55linda:receive( linda.batched, "key", COUNT)
51print "waiting a bit more ..." 56print "waiting a bit more ..."
52linda:receive( 1, "foo") 57SLEEP(1)
53print "SUCCESS" 58print "SUCCESS"