Fixed broken threads for love

This commit is contained in:
2023-01-20 00:11:55 -05:00
parent 0994ee2d2a
commit ef9267d8fc
2 changed files with 43 additions and 71 deletions
+5 -14
View File
@@ -25,7 +25,7 @@ require("love.timer")
require("love.system")
require("love.data")
require("love.thread")
local multi, thread = require("multi").init()
local multi, thread = require("multi"):init()
local threads = {}
function threads.loadDump(d)
@@ -180,20 +180,11 @@ function threads.getConsole()
end
if not ISTHREAD then
local clock = os.clock
local lastproc = clock()
local queue = love.thread.getChannel("__CONSOLE__")
thread:newThread("consoleManager",function()
while true do
thread.yield()
dat = queue:pop()
if dat then
lastproc = clock()
print(unpack(dat))
end
if clock()-lastproc>2 then
thread.sleep(.1)
end
multi:newLoop(function(loop)
dat = queue:pop()
if dat then
print(unpack(dat))
end
end)
end