This commit is contained in:
Manuel Simon Hirsig
2015-10-16 19:24:45 +02:00
5 changed files with 122 additions and 102 deletions
+12 -7
View File
@@ -66,16 +66,21 @@ function wait_for_complete_results(k)
end
function wait_for_callback(f, args, k)
local ok
local ok = true
if not f then
ok = true
else
tinsert(args, 1, function() ok = true end)
if f then
tinsert(args, {
suspend = function() ok = false end,
resume = function() ok = true end,
})
f(unpack(args))
end
return controller().wait(function() return ok end, k)
if ok then
return k()
else
return controller().wait(function() return ok end, k)
end
end
function scan()
@@ -147,4 +152,4 @@ function submit_query(k)
else
return k()
end
end
end