diff options
| author | Benoit Germain <bnt.germain@gmail.com> | 2012-09-10 20:41:03 +0200 |
|---|---|---|
| committer | Benoit Germain <bnt.germain@gmail.com> | 2012-09-10 20:41:03 +0200 |
| commit | 242feeb342f68999b02c2b8dc4614abefdab8431 (patch) | |
| tree | 904a3898035f89e5656036a0e7d454f560eb0455 /tests | |
| parent | e37191ab11102ee784dc88578165074d2d0a2fff (diff) | |
| download | lanes-242feeb342f68999b02c2b8dc4614abefdab8431.tar.gz lanes-242feeb342f68999b02c2b8dc4614abefdab8431.tar.bz2 lanes-242feeb342f68999b02c2b8dc4614abefdab8431.zip | |
version 3.3.0
* lane.status can return "killed" if lane was forcefully killed with lanes:cancel()
* lane:join(): return nil, "killed" if called on a killed lane.
* lane[<n>]: produces [1] = nil, [2] = "killed" if the lane was killed
* lane:join(): fixed an assertion in debug builds when joining a lane forcefully cancelled with lane:cancel( <x>, true).
* indexing a lane with a string other than "join", "cancel" or "status" raises an error.
* fixed configure() to correctly apply defaults when they are missing from the provided settings
* added a shutdown_timeout to control the duration Lanes will wait for graceful termination of running lanes at application shutdown. Default is 0.25.
Among other things, fixes issue #31.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/fibonacci.lua | 6 | ||||
| -rw-r--r-- | tests/finalizer.lua | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/tests/fibonacci.lua b/tests/fibonacci.lua index 452a770..48cd8d7 100644 --- a/tests/fibonacci.lua +++ b/tests/fibonacci.lua | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | -- Parallel calculation of Fibonacci numbers | 4 | -- Parallel calculation of Fibonacci numbers |
| 5 | -- | 5 | -- |
| 6 | -- A sample of task splitting like Intel TBB library does. | 6 | -- A sample of task splitting like Intel TBB library does. |
| 7 | -- | 7 | -- |
| 8 | -- References: | 8 | -- References: |
| 9 | -- Intel Threading Building Blocks, 'test all' | 9 | -- Intel Threading Building Blocks, 'test all' |
| 10 | -- <http://shareit.intel.com/WikiHome/Articles/111111316> | 10 | -- <http://shareit.intel.com/WikiHome/Articles/111111316> |
| @@ -41,7 +41,7 @@ local function fib( n ) | |||
| 41 | -- | 41 | -- |
| 42 | -- note that lanes is pulled in as upvalue, so we need package library to require internals properly | 42 | -- note that lanes is pulled in as upvalue, so we need package library to require internals properly |
| 43 | -- (because lua51-lanes is always required internally if possible, which is necessary in that case) | 43 | -- (because lua51-lanes is always required internally if possible, which is necessary in that case) |
| 44 | local gen_f= lanes.gen( "package,string,io,math,debug", fib ) | 44 | local gen_f= lanes.gen( "*", fib ) |
| 45 | 45 | ||
| 46 | local n1=floor(n/2) +1 | 46 | local n1=floor(n/2) +1 |
| 47 | local n2=floor(n/2) -1 + n%2 | 47 | local n2=floor(n/2) -1 + n%2 |
| @@ -60,7 +60,7 @@ local function fib( n ) | |||
| 60 | end | 60 | end |
| 61 | 61 | ||
| 62 | io.stderr:write( "fib("..n..") = "..sum.."\n" ) | 62 | io.stderr:write( "fib("..n..") = "..sum.."\n" ) |
| 63 | 63 | ||
| 64 | return sum | 64 | return sum |
| 65 | end | 65 | end |
| 66 | 66 | ||
diff --git a/tests/finalizer.lua b/tests/finalizer.lua index 6f186ab..dc9ed34 100644 --- a/tests/finalizer.lua +++ b/tests/finalizer.lua | |||
| @@ -31,6 +31,7 @@ local function lane() | |||
| 31 | io.stderr:write( "File "..FN.." created\n" ) | 31 | io.stderr:write( "File "..FN.." created\n" ) |
| 32 | 32 | ||
| 33 | if which==0 then | 33 | if which==0 then |
| 34 | print "you loose" | ||
| 34 | error("aa") -- exception here; the value needs NOT be a string | 35 | error("aa") -- exception here; the value needs NOT be a string |
| 35 | end | 36 | end |
| 36 | 37 | ||
| @@ -55,6 +56,7 @@ cleanup= function(err) | |||
| 55 | end | 56 | end |
| 56 | 57 | ||
| 57 | local _,err2= os.remove(FN) | 58 | local _,err2= os.remove(FN) |
| 59 | print( "file removal result: ", tostring( err2)) | ||
| 58 | assert(not err2) -- if this fails, it will be shown in the calling script | 60 | assert(not err2) -- if this fails, it will be shown in the calling script |
| 59 | -- as an error from the lane itself | 61 | -- as an error from the lane itself |
| 60 | 62 | ||
