Fixed some issues with threads

This commit is contained in:
2023-01-21 13:18:44 -05:00
parent ef9267d8fc
commit 7da192e8dc
4 changed files with 51 additions and 11 deletions
+8 -3
View File
@@ -47,7 +47,14 @@ multi.integration.THREAD = THREAD
pcall(require,"multi.integration.loveManager.extensions")
stab["returns"] = {THREAD.loadDump(__FUNC__)(unpack(__IMPORTS))}
]]
local multi, thread = require("multi"):init()
-- We do not want to load this module twice
if multi.integration and multi.integration.THREAD then
return multi.integration.GLOBAL, multi.integration.THREAD
end
local THREAD = {}
__THREADID__ = 0
__THREADNAME__ = "MainThread"
@@ -55,8 +62,6 @@ multi.integration = {}
local THREAD = require("multi.integration.loveManager.threads")
local GLOBAL = THREAD.getGlobal()
local THREAD_ID = 1
local OBJECT_ID = 0
local stf = 0
function multi:newSystemThread(name, func, ...)
local c = {}
@@ -72,7 +77,7 @@ function multi:newSystemThread(name, func, ...)
THREAD_ID = THREAD_ID + 1
function c:getName() return c.name end
thread:newThread(name .. "_System_Thread_Handler",function()
if name == "TempSystemThread" then
if name == "SystemThreaded Function Handler" then
local status_channel = love.thread.getChannel("STATCHAN_" .. c.ID)
thread.hold(function()
-- While the thread is running we might as well do something in the loop
+2 -2
View File
@@ -97,9 +97,9 @@ function threads.kill()
end
function threads.pushStatus(...)
local status_channel = love.thread.getChannel("__"..__THREADID__.."__MULTI__STATUS_CHANNEL__")
local status_channel = love.thread.getChannel("STATCHAN_" ..__THREADID__)
local args = {...}
status_channel:push(__THREADID__, args)
status_channel:push(args)
end
function threads.getThreads()