aboutsummaryrefslogtreecommitdiff
path: root/tests/linda_perf.lua
diff options
context:
space:
mode:
authorBenoit Germain <bnt period germain arrobase gmail period com>2014-01-16 14:17:23 +0100
committerBenoit Germain <bnt period germain arrobase gmail period com>2014-01-16 14:17:23 +0100
commit1843a0add00186eee129b0b0a2ee605866acbb61 (patch)
tree5de8d13e1b8495836f898c17790adf571f05365c /tests/linda_perf.lua
parentbaaea3cebf9d787f76557b68f18a012dc6adbbbc (diff)
downloadlanes-1843a0add00186eee129b0b0a2ee605866acbb61.tar.gz
lanes-1843a0add00186eee129b0b0a2ee605866acbb61.tar.bz2
lanes-1843a0add00186eee129b0b0a2ee605866acbb61.zip
Cancellation improvements and some fixes
* bumped version to 3.7.8 * lane:cancel() now accepts a boolean second argument when soft cancelling (negative timeout) to wake the thread if necessary * if a blocked linda send() or receive() call is interrupted by a cancellation request, it returns CANCEL_ERROR so that this case can be differentiated from a simple timeout * fixed WIN32 THREAD_CREATE() wrong _beginthreadex() error detection * fatal WIN32 threading errors retrieve and output the error description string with FormatMessage() * fixed missing lanes.set_singlethreaded * fixed perftest.lua * added test/cancel.lua
Diffstat (limited to 'tests/linda_perf.lua')
-rw-r--r--tests/linda_perf.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/linda_perf.lua b/tests/linda_perf.lua
index ebe9eac..9348f71 100644
--- a/tests/linda_perf.lua
+++ b/tests/linda_perf.lua
@@ -34,7 +34,7 @@ local function ziva( preloop, loop, batch)
34 -- prefill the linda a bit to increase fifo stress 34 -- prefill the linda a bit to increase fifo stress
35 local top = math.max( preloop, loop) 35 local top = math.max( preloop, loop)
36 local l, lane = lanes.linda() 36 local l, lane = lanes.linda()
37 local t1 = os.time() 37 local t1 = lanes.now_secs()
38 for i = 1, preloop do 38 for i = 1, preloop do
39 l:send( "key", i) 39 l:send( "key", i)
40 end 40 end
@@ -59,7 +59,7 @@ local function ziva( preloop, loop, batch)
59 end 59 end
60 l:send( "done" ,"are you happy?") 60 l:send( "done" ,"are you happy?")
61 lane:join() 61 lane:join()
62 return os.difftime(os.time(), t1) 62 return lanes.now_secs() - t1
63end 63end
64 64
65local tests = 65local tests =
@@ -149,7 +149,7 @@ local function ziva2( preloop, loop, batch)
149 l:receive( "key") 149 l:receive( "key")
150 end 150 end
151 end 151 end
152 local t1 = os.time() 152 local t1 = lanes.now_secs()
153 -- first, prime the linda with some data 153 -- first, prime the linda with some data
154 for i = 1, preloop, step do 154 for i = 1, preloop, step do
155 batch_send() 155 batch_send()
@@ -165,7 +165,7 @@ local function ziva2( preloop, loop, batch)
165 for i = 1, preloop, step do 165 for i = 1, preloop, step do
166 batch_read() 166 batch_read()
167 end 167 end
168 return os.difftime(os.time(), t1) 168 return lanes.now_secs() - t1
169end 169end
170 170
171local tests2 = 171local tests2 =