Testing actions, fixing bugs with lanes

This commit is contained in:
2023-07-04 13:05:07 -04:00
parent b2569118a2
commit 614e032aa5
15 changed files with 242 additions and 25 deletions
+13 -1
View File
@@ -34,6 +34,7 @@ function multi:newSystemThreadedQueue(name)
local c = {}
c.Name = name
c.linda = lanes.linda()
c.Type = multi.SQUEUE
function c:push(v)
self.linda:send("Q", v)
@@ -57,6 +58,8 @@ function multi:newSystemThreadedQueue(name)
GLOBAL[name] = c
end
self:create(c)
return c
end
@@ -65,6 +68,7 @@ function multi:newSystemThreadedTable(name)
local c = {}
c.link = lanes.linda()
c.Name = name
c.Type = multi.STABLE
function c:init()
return self
@@ -85,12 +89,15 @@ function multi:newSystemThreadedTable(name)
GLOBAL[name] = c
end
self:create(c)
return c
end
function multi:newSystemThreadedJobQueue(n)
local c = {}
c.cores = n or THREAD.getCores()*2
c.Type = multi.SJOBQUEUE
c.OnJobCompleted = multi:newConnection()
local funcs = multi:newSystemThreadedTable():init()
local queueJob = multi:newSystemThreadedQueue():init()
@@ -133,7 +140,6 @@ function multi:newSystemThreadedJobQueue(n)
link = c.OnJobCompleted(function(jid,...)
if id==jid then
rets = multi.pack(...)
c.OnJobCompleted:Unconnect(link)
end
end)
return thread.hold(function()
@@ -207,12 +213,16 @@ function multi:newSystemThreadedJobQueue(n)
multi:mainloop()
end,i).OnError(multi.error)
end
self:create(c)
return c
end
function multi:newSystemThreadedConnection(name)
local name = name or multi.randomString(16)
local c = {}
c.Type = multi.SCONNECTION
c.CONN = 0x00
c.TRIG = 0x01
c.PING = 0x02
@@ -348,6 +358,8 @@ function multi:newSystemThreadedConnection(name)
GLOBAL[name] = c
end
self:create(c)
return c
end
require("multi.integration.sharedExtensions")
+5 -5
View File
@@ -32,9 +32,7 @@ if multi.integration then -- This allows us to call the lanes manager from suppo
}
end
-- Step 1 get lanes
lanes = require("lanes").configure{
nb_keepers = 4,
}
lanes = require("lanes").configure()
multi.SystemThreads = {}
multi.isMainThread = true
@@ -63,7 +61,7 @@ local livingThreads = {}
function THREAD:newFunction(func, holdme)
return thread:newFunctionBase(function(...)
return multi:newSystemThread("TempSystemThread",func,...)
end, holdme)()
end, holdme, multi.SFUNCTION)()
end
function multi:newSystemThread(name, func, ...)
@@ -143,7 +141,9 @@ function multi:newSystemThread(name, func, ...)
return c
end
THREAD.newSystemThread = multi.newSystemThread
THREAD.newSystemThread = function(...)
multi:newSystemThread(...)
end
function multi.InitSystemThreadErrorHandler()
if started == true then