diff options
Diffstat (limited to 'tests/keeper.lua')
| -rw-r--r-- | tests/keeper.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/keeper.lua b/tests/keeper.lua index 9b38f02..6dbbd15 100644 --- a/tests/keeper.lua +++ b/tests/keeper.lua | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | -- Test program for Lua Lanes | 4 | -- Test program for Lua Lanes |
| 5 | -- | 5 | -- |
| 6 | 6 | ||
| 7 | local lanes = require "lanes".configure{ with_timers = false, nb_keepers = 200} | 7 | local lanes = require "lanes".configure{ with_timers = false, nb_keepers = 1, keepers_gc_threshold = 500} |
| 8 | 8 | ||
| 9 | do | 9 | do |
| 10 | print "Linda names test:" | 10 | print "Linda names test:" |
| @@ -12,7 +12,20 @@ do | |||
| 12 | local unnamedLinda2 = lanes.linda("") | 12 | local unnamedLinda2 = lanes.linda("") |
| 13 | local veeeerrrryyyylooongNamedLinda= lanes.linda( "veeeerrrryyyylooongNamedLinda", 1) | 13 | local veeeerrrryyyylooongNamedLinda= lanes.linda( "veeeerrrryyyylooongNamedLinda", 1) |
| 14 | print(unnamedLinda, unnamedLinda2, veeeerrrryyyylooongNamedLinda) | 14 | print(unnamedLinda, unnamedLinda2, veeeerrrryyyylooongNamedLinda) |
| 15 | print "GC deadlock test start" | ||
| 16 | -- store a linda in another linda (-> in a keeper) | ||
| 17 | unnamedLinda:set("here", lanes.linda("temporary linda")) | ||
| 18 | -- repeatedly add and remove stuff in the linda so that a GC happens during the keeper operation | ||
| 19 | for i = 1, 1000 do | ||
| 20 | for j = 1, 1000 do -- send 1000 tables | ||
| 21 | unnamedLinda:send("here", {"a", "table", "with", "some", "stuff"}) | ||
| 22 | end | ||
| 23 | unnamedLinda:set("here") -- clear everything | ||
| 24 | end | ||
| 15 | end | 25 | end |
| 26 | print "collecting garbage" | ||
| 27 | collectgarbage() | ||
| 28 | print "GC deadlock test done" | ||
| 16 | 29 | ||
| 17 | local print_id = 0 | 30 | local print_id = 0 |
| 18 | local PRINT = function(...) | 31 | local PRINT = function(...) |
