From 7f7b29063d2f19a8bc2b229ae9b0ec82ce447cab Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Tue, 13 Aug 2013 08:12:05 +0200 Subject: version 3.6.3 * lane:cancel() only causes cancel_test() to return true but won't interrupt execution of the lane during linda operations * more explicit errors when trying to transfer unknown source functions (with new configure option verbose_errors) * default options wrap allocator around a mutex when run by LuaJIT --- tests/fifo.lua | 7 ++++--- tests/linda_perf.lua | 5 +++++ tests/require.lua | 7 ++++--- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/fifo.lua b/tests/fifo.lua index b68d8a4..47db4c9 100644 --- a/tests/fifo.lua +++ b/tests/fifo.lua @@ -4,10 +4,9 @@ -- Sample program for Lua Lanes -- -local lanes = require "lanes" -lanes.configure() +local lanes = require "lanes".configure{shutdown_timeout=3,with_timers=true} -local linda= lanes.linda() +local linda= lanes.linda( "atom") local atomic_inc= lanes.genatomic( linda, "FIFO_n" ) assert( atomic_inc()==1 ) @@ -46,3 +45,5 @@ print( B:receive( 2.0 ) ) -- Note: A and B can be passed between threads, or used as upvalues -- by multiple threads (other parts will be copied but the 'linda' -- handle is shared userdata and will thus point to the single place) +lanes.timer_lane:cancel() +lanes.timer_lane:join() \ No newline at end of file diff --git a/tests/linda_perf.lua b/tests/linda_perf.lua index be582ce..ebe9eac 100644 --- a/tests/linda_perf.lua +++ b/tests/linda_perf.lua @@ -84,8 +84,10 @@ local tests = { 4000000, 0, 21}, { 4000000, 0, 44},]] } +print "tests #1" for k, v in pairs( tests) do local pre, loop, batch = v[1], v[2], v[3] + print( "testing", pre, loop, batch) print( pre, loop, batch, "duration = " .. ziva( pre, loop, batch)) end @@ -188,8 +190,11 @@ local tests2 = { 4000000, 0, 21}, { 4000000, 0, 44}, } + +print "tests #2" for k, v in pairs( tests2) do local pre, loop, batch = v[1], v[2], v[3] + print( "testing", pre, loop, batch) print( pre, loop, batch, "duration = " .. ziva2( pre, loop, batch)) end diff --git a/tests/require.lua b/tests/require.lua index 1d081b4..656a7dd 100644 --- a/tests/require.lua +++ b/tests/require.lua @@ -4,9 +4,10 @@ -- Test that 'require' works from sublanes -- lanes = require "lanes" -lanes.configure() +lanes.configure{with_timers = false} local function a_lane() + print "IN A LANE" -- To require 'math' we still actually need to have it initialized for -- the lane. -- @@ -15,7 +16,7 @@ local function a_lane() assert( math.sqrt(4)==2 ) assert( lanes==nil ) - local lanes = require "lanes".configure() + local lanes = require "lanes".configure{with_timers = false} assert( lanes and lanes.gen ) local h= lanes.gen( function() return 42 end ) () @@ -24,7 +25,7 @@ local function a_lane() return v==42 end -local gen= lanes.gen( "math,package,string,table", a_lane ) +local gen= lanes.gen( "math,package,string,table", {package={}},a_lane ) local h= gen() local ret= h[1] -- cgit v1.2.3-55-g6feb