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