fix the ret value by which we can stop benchmark in event

This commit is contained in:
caojiafeng
2018-01-02 13:44:43 +08:00
committed by Alexey Kopytov
parent 2cdb3adaa8
commit b7dd7e0781
2 changed files with 45 additions and 4 deletions

View File

@ -26,13 +26,12 @@ bool sb_more_events(int thread_id);
-- Main event loop. This is a Lua version of sysbench.c:thread_run()
-- ----------------------------------------------------------------------
function thread_run(thread_id)
local success, ret
while ffi.C.sb_more_events(thread_id) do
ffi.C.sb_event_start(thread_id)
local success, ret
repeat
local success, ret = pcall(event, thread_id)
success, ret = pcall(event, thread_id)
if not success then
if type(ret) ~= "table" or
@ -43,7 +42,7 @@ function thread_run(thread_id)
end
until success
-- Stop the benchmark if event() returns a non-nil value
-- Stop the benchmark if event() returns a value other than nil or false
if ret then
break
end