Working on 16.0.0 #53
@ -130,7 +130,6 @@ function multi:newSystemThreadedJobQueue(n)
|
|||||||
link = c.OnJobCompleted(function(jid,...)
|
link = c.OnJobCompleted(function(jid,...)
|
||||||
if id==jid then
|
if id==jid then
|
||||||
rets = {...}
|
rets = {...}
|
||||||
link:Destroy()
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
return thread.hold(function()
|
return thread.hold(function()
|
||||||
|
|||||||
@ -40,6 +40,12 @@ math.random()
|
|||||||
math.random()
|
math.random()
|
||||||
stab = THREAD.createStaticTable(__THREADNAME__ .. __THREADID__)
|
stab = THREAD.createStaticTable(__THREADNAME__ .. __THREADID__)
|
||||||
GLOBAL = THREAD.getGlobal()
|
GLOBAL = THREAD.getGlobal()
|
||||||
|
if GLOBAL["__env"] then
|
||||||
|
local env = THREAD.unpackENV(GLOBAL["__env"])
|
||||||
|
for i,v in pairs(env) do
|
||||||
|
_G[i] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
multi, thread = require("multi").init()
|
multi, thread = require("multi").init()
|
||||||
multi.integration={}
|
multi.integration={}
|
||||||
multi.integration.GLOBAL = GLOBAL
|
multi.integration.GLOBAL = GLOBAL
|
||||||
|
|||||||
@ -139,8 +139,36 @@ function threads.getGlobal()
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function THREAD.setENV(env)
|
function threads.packENV(env)
|
||||||
(threads.getGlobal())["__env"] = env
|
local e = {}
|
||||||
|
for i,v in pairs(env) do
|
||||||
|
if type(v) == "function" then
|
||||||
|
e["$f"..i] = string.dump(v)
|
||||||
|
elseif type(v) == "table" then
|
||||||
|
e["$t"..i] = threads.packENV(v)
|
||||||
|
else
|
||||||
|
e[i] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return e
|
||||||
|
end
|
||||||
|
|
||||||
|
function threads.unpackENV(env)
|
||||||
|
local e = {}
|
||||||
|
for i,v in pairs(env) do
|
||||||
|
if type(i) == "string" and i:sub(1,2) == "$f" then
|
||||||
|
e[i:sub(3,-1)] = loadstring(v)
|
||||||
|
elseif type(i) == "string" and i:sub(1,2) == "$t" then
|
||||||
|
e[i:sub(3,-1)] = threads.unpackENV(v)
|
||||||
|
else
|
||||||
|
e[i] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return e
|
||||||
|
end
|
||||||
|
|
||||||
|
function threads.setENV(env)
|
||||||
|
(threads.getGlobal())["__env"] = threads.packENV(env)
|
||||||
end
|
end
|
||||||
|
|
||||||
function threads.createTable(n)
|
function threads.createTable(n)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user