diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2012-09-26 21:22:30 +0200 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2012-09-26 21:22:30 +0200 |
commit | bba4ecea15320dfbf8edf35f7361de374d895ace (patch) | |
tree | 73bd0bfd29d2c4dbfe3a46681b0e3b2261352207 /tests/linda_perf.lua | |
parent | 282f59ca02d1d1f304b9126b84a8b1427caf3172 (diff) | |
download | lanes-bba4ecea15320dfbf8edf35f7361de374d895ace.tar.gz lanes-bba4ecea15320dfbf8edf35f7361de374d895ace.tar.bz2 lanes-bba4ecea15320dfbf8edf35f7361de374d895ace.zip |
version 3.4.0
* new method linda:dump() that outputs the full contents of a linda as a table, also linked to __towatch for Decoda support
* linda:receive() API change!
* instead of [val, key], linda:receive( timeout, key) returns [key, val]
* instead of [val, [...]], linda:receive( timeout, linda.batched key) returns [key, val[, ...]]
this is to unify the return values of regular and batched mode, and to be able to tell when batched mode is interrupted by a lane cancellation
* fixed Lua 5.2 build to take into account the "loaders"->"searchers" name change in 'package' module.
* a bit of html cleanup and added some infos in the documentation regarding the Lanes internals
Diffstat (limited to 'tests/linda_perf.lua')
-rw-r--r-- | tests/linda_perf.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/linda_perf.lua b/tests/linda_perf.lua index fff2670..87e0da7 100644 --- a/tests/linda_perf.lua +++ b/tests/linda_perf.lua | |||
@@ -3,24 +3,24 @@ lanes.configure() | |||
3 | 3 | ||
4 | -- this lane eats items in the linda one by one | 4 | -- this lane eats items in the linda one by one |
5 | local eater = function( l, loop) | 5 | local eater = function( l, loop) |
6 | local val, key = l:receive( "go") | 6 | local key, val = l:receive( "go") |
7 | for i = 1, loop do | 7 | for i = 1, loop do |
8 | local val, key = l:receive( "key") | 8 | local val, key = l:receive( "key") |
9 | --print( val) | 9 | --print( val) |
10 | end | 10 | end |
11 | -- print "loop is over" | 11 | -- print "loop is over" |
12 | val, key = l:receive( "done") | 12 | key, val = l:receive( "done") |
13 | -- print( val) | 13 | -- print( val) |
14 | end | 14 | end |
15 | 15 | ||
16 | -- this lane eats items in the linda in batches | 16 | -- this lane eats items in the linda in batches |
17 | local batched = function( l, loop, batch) | 17 | local batched = function( l, loop, batch) |
18 | local val, key = l:receive( "go") | 18 | local key, val = l:receive( "go") |
19 | for i = 1, loop/batch do | 19 | for i = 1, loop/batch do |
20 | l:receive( l.batched, "key", batch) | 20 | l:receive( l.batched, "key", batch) |
21 | end | 21 | end |
22 | print "loop is over" | 22 | print "loop is over" |
23 | val, key = l:receive( "done") | 23 | key, val = l:receive( "done") |
24 | print( val) | 24 | print( val) |
25 | end | 25 | end |
26 | 26 | ||