mirror of
https://github.com/rayaman/multi.git
synced 2026-09-05 07:27:35 -04:00
Removed extra bloat, proxies are portable now!
This commit is contained in:
@@ -113,7 +113,7 @@ function multi:newSystemThreadedJobQueue(n)
|
||||
return self
|
||||
end
|
||||
function c:pushJob(name,...)
|
||||
queueJob:push{name,jid,{...}}
|
||||
queueJob:push{name,jid,multi.pack(...)}
|
||||
jid = jid + 1
|
||||
return jid-1
|
||||
end
|
||||
@@ -132,12 +132,16 @@ function multi:newSystemThreadedJobQueue(n)
|
||||
local rets
|
||||
link = c.OnJobCompleted(function(jid,...)
|
||||
if id==jid then
|
||||
rets = {...}
|
||||
rets = multi.pack(...)
|
||||
end
|
||||
end)
|
||||
return thread.hold(function()
|
||||
if rets then
|
||||
return multi.unpack(rets) or multi.NIL
|
||||
if #rets == 0 then
|
||||
return multi.NIL
|
||||
else
|
||||
return multi.unpack(rets)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end, holup), name
|
||||
@@ -171,7 +175,7 @@ function multi:newSystemThreadedJobQueue(n)
|
||||
local name = table.remove(dat, 1)
|
||||
local jid = table.remove(dat, 1)
|
||||
local args = table.remove(dat, 1)
|
||||
queueReturn:push{jid, funcs[name](multi.unpack(args)), queue}
|
||||
queueReturn:push{jid, funcs[name](args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]), queue}
|
||||
end).OnError(multi.error)
|
||||
end
|
||||
end).OnError(multi.error)
|
||||
@@ -258,7 +262,7 @@ function multi:newSystemThreadedConnection(name)
|
||||
|
||||
local function fire(...)
|
||||
for _, link in pairs(c.links) do
|
||||
link:push {c.TRIG, {...}}
|
||||
link:push {c.TRIG, multi.pack(...)}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -286,7 +290,7 @@ function multi:newSystemThreadedConnection(name)
|
||||
--- ^^^ This will only exist in the init thread
|
||||
|
||||
function c:Fire(...)
|
||||
local args = {...}
|
||||
local args = multi.pack(...)
|
||||
if self.CID == THREAD_ID then -- Host Call
|
||||
for _, link in pairs(self.links) do
|
||||
link:push {self.TRIG, args}
|
||||
|
||||
@@ -98,6 +98,13 @@ function multi:newSystemThread(name, func, ...)
|
||||
globals = globe,
|
||||
priority = c.priority
|
||||
},function(...)
|
||||
local profi
|
||||
|
||||
if multi_settings.debug then
|
||||
profi = require("proFI")
|
||||
profi:start()
|
||||
end
|
||||
|
||||
multi, thread = require("multi"):init(multi_settings)
|
||||
require("multi.integration.lanesManager.extensions")
|
||||
require("multi.integration.sharedExtensions")
|
||||
@@ -105,6 +112,12 @@ function multi:newSystemThread(name, func, ...)
|
||||
returns = {pcall(func, ...)}
|
||||
return_linda:set("returns", returns)
|
||||
has_error = false
|
||||
if profi then
|
||||
multi.OnExit(function(...)
|
||||
profi:stop()
|
||||
profi:writeReport("Profiling Report [".. THREAD_NAME .."].txt")
|
||||
end)
|
||||
end
|
||||
end)(...)
|
||||
count = count + 1
|
||||
function c:getName()
|
||||
@@ -118,6 +131,13 @@ function multi:newSystemThread(name, func, ...)
|
||||
c.OnDeath = multi:newConnection()
|
||||
c.OnError = multi:newConnection()
|
||||
GLOBAL["__THREADS__"] = livingThreads
|
||||
|
||||
if self.isActor then
|
||||
self:create(c)
|
||||
else
|
||||
multi.create(multi, c)
|
||||
end
|
||||
|
||||
return c
|
||||
end
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ local function INIT(__GlobalLinda, __SleepingLinda, __StatusLinda, __Console)
|
||||
local c = {}
|
||||
c.queue = __Console
|
||||
function c.print(...)
|
||||
c.queue:send("Q", {...})
|
||||
c.queue:send("Q", multi.pack(...))
|
||||
end
|
||||
function c.error(err)
|
||||
c.queue:push("Q",{"ERROR in <"..__THREADNAME__..">: "..err,__THREADID__})
|
||||
@@ -90,7 +90,7 @@ local function INIT(__GlobalLinda, __SleepingLinda, __StatusLinda, __Console)
|
||||
end
|
||||
|
||||
function THREAD.pushStatus(...)
|
||||
local args = {...}
|
||||
local args = multi.pack(...)
|
||||
__StatusLinda:send(nil,THREAD_ID, args)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user