aboutsummaryrefslogtreecommitdiff
path: root/tests/fifo.lua
diff options
context:
space:
mode:
authorBenoit Germain <bnt.germain@gmail.com>2011-11-05 17:31:02 +0100
committerBenoit Germain <bnt.germain@gmail.com>2011-11-05 17:31:02 +0100
commit053f7cff3c95acb915e6babfd306971f11bb7986 (patch)
treeee38c60b1119d34eb96aea1105ef033e851d266e /tests/fifo.lua
parent717eadee9c3644fabb32c7ee59949f2846143690 (diff)
downloadlanes-053f7cff3c95acb915e6babfd306971f11bb7986.tar.gz
lanes-053f7cff3c95acb915e6babfd306971f11bb7986.tar.bz2
lanes-053f7cff3c95acb915e6babfd306971f11bb7986.zip
* process exit change: close everything at GC when main state closes, not when atexit() handlers are processed
* Lua 5.2-style module: * module() is no longer used to implement lanes.lua * a global "lanes" variable is no longer created when the module is required * the Lanes module table is returned instead * Lanes must be initialized before used: * the first occurence of 'require "lanes"' produces a minimal interface that only contains a configure() function * the remainder of the interface is made available once this function is called * subsequent calls to configure() do nothing * configure() controls the number of keeper states and the startup of timers * LuaJIT 2 compatibility * non-Lua functions are no longer copied by creating a C closure from a C pointer, but through 2-way lookup tables * this means that if a lane function body pulls non-Lua functions, the lane generator description must contain the list of libraries and modules that exports them * introduces a change in configuration .globals management: contents are copied *after* std libs are loaded * new .required configuration entry to list modules that must be require()'ed before lane body is transferred * lane:cancel() wakes up waiting lindas like what is done at lane shutdown
Diffstat (limited to 'tests/fifo.lua')
-rw-r--r--tests/fifo.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/fifo.lua b/tests/fifo.lua
index 898b04d..d8289c1 100644
--- a/tests/fifo.lua
+++ b/tests/fifo.lua
@@ -4,7 +4,8 @@
4-- Sample program for Lua Lanes 4-- Sample program for Lua Lanes
5-- 5--
6 6
7require "lanes" 7local lanes = require "lanes"
8lanes.configure( 1)
8 9
9local linda= lanes.linda() 10local linda= lanes.linda()
10local atomic_inc= lanes.genatomic( linda, "FIFO_n" ) 11local atomic_inc= lanes.genatomic( linda, "FIFO_n" )
@@ -18,8 +19,12 @@ local function FIFO()
18 return { 19 return {
19 -- Giving explicit 'nil' timeout allows numbers to be used as 'my_channel' 20 -- Giving explicit 'nil' timeout allows numbers to be used as 'my_channel'
20 -- 21 --
21 send= function(...) linda:send( nil, my_channel, ... ) end, 22 send= function(self, ...)
22 receive= function(timeout) linda:receive( timeout, my_channel ) end 23 linda:send( nil, my_channel, ... )
24 end,
25 receive = function(self, timeout)
26 linda:receive( timeout, my_channel )
27 end
23 } 28 }
24end 29end
25 30