Fix: task queue not working

This commit is contained in:
Coder12a 2019-05-21 11:51:50 -05:00
parent bc3125b34a
commit fd6c593066
1 changed files with 3 additions and 3 deletions

View File

@ -151,7 +151,7 @@ function async.Async()
end
self.queue_task = function(func, callback)
table.insert(self.task_queue, {func = func,callback = callback})
table.insert(self.task_queue, {func = func, callback = callback})
if self.queue_threads > 0 then
self.queue_threads = self.queue_threads - 1
self.create_worker(function()
@ -159,8 +159,8 @@ function async.Async()
local last_time = minetest.get_us_time() / 1000
local maxtime = self.maxtime
while(true) do
local task_func = self.task_queue[1]
table.remove(self.task_queue, 1)
local task_func = self.task_queue[#self.task_queue]
self.task_queue[#self.task_queue] = nil
if task_func and task_func.func then
pass_arg = nil
local p = task_func.func()