mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
review async unblocking
This commit is contained in:
parent
923f2f1979
commit
0dbc30a88c
1 changed files with 2 additions and 7 deletions
|
@ -210,16 +210,10 @@ unittests.register("test_async_vector", test_vector_preserve, {async=true})
|
|||
|
||||
local function test_async_job_replacement(cb)
|
||||
local capacity = core.get_async_threading_capacity()
|
||||
local running = capacity
|
||||
for _ = 1, capacity do
|
||||
core.handle_async(function()
|
||||
core.ipc_poll("unittests:end_blocking", 1000)
|
||||
end, function()
|
||||
running = running - 1
|
||||
if running <= 0 then
|
||||
core.ipc_set("unittests:end_blocking", nil)
|
||||
end
|
||||
end)
|
||||
end, function() end)
|
||||
end
|
||||
local job = core.handle_async(function(x)
|
||||
return x
|
||||
|
@ -235,6 +229,7 @@ local function test_async_job_replacement(cb)
|
|||
job = core.handle_async(function(x)
|
||||
return x
|
||||
end, function(ret)
|
||||
core.ipc_set("unittests:end_blocking", nil)
|
||||
if job:cancel() then
|
||||
return cb("AsyncJob:cancel canceled a completed job")
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue