Writing tests for system threading

This commit is contained in:
2023-04-24 00:15:35 -04:00
parent 8e6d174f20
commit d2cfdfa8e8
5 changed files with 116 additions and 11 deletions
+14 -11
View File
@@ -78,19 +78,22 @@ function multi:newSystemThread(name, func, ...)
c.alive = true
c.priority = THREAD.Priority_Normal
local multi_settings = multi.defaultSettings
for i,v in pairs(multi_settings) do
print(i,v)
local globe = {
THREAD_NAME = name,
THREAD_ID = count,
THREAD = THREAD,
GLOBAL = GLOBAL,
_Console = __ConsoleLinda
}
if GLOBAL["__env"] then
for i,v in pairs(GLOBAL["__env"]) do
globe[i] = v
end
end
c.thread = lanes.gen("*",
{
globals={ -- Set up some globals
THREAD_NAME = name,
THREAD_ID = count,
THREAD = THREAD,
GLOBAL = GLOBAL,
_Console = __ConsoleLinda
},
priority=c.priority
globals = globe,
priority = c.priority
},function(...)
require("multi"):init(multi_settings)
require("multi.integration.lanesManager.extensions")
@@ -168,7 +171,7 @@ function multi.InitSystemThreadErrorHandler()
end)
end
multi.print("Integrated Lanes!")
multi.print("Integrated Lanes Threading!")
multi.integration = {} -- for module creators
multi.integration.GLOBAL = GLOBAL
multi.integration.THREAD = THREAD
+5
View File
@@ -134,6 +134,11 @@ local function INIT(__GlobalLinda, __SleepingLinda, __StatusLinda, __Console)
__GlobalLinda:set(k, v)
end
})
function THREAD.setENV(env)
GLOBAL["__env"] = env
end
return GLOBAL, THREAD
end
+4
View File
@@ -139,6 +139,10 @@ function threads.getGlobal()
)
end
function THREAD.setENV(env)
(threads.getGlobal())["__env"] = env
end
function threads.createTable(n)
local _proxy = {}
local function set(name,val)
+4
View File
@@ -102,6 +102,10 @@ local function INIT(thread)
THREAD.hold = thread.hold
function THREAD.setENV(env)
GLOBAL["__env"] = env
end
return GLOBAL, THREAD
end