Working on getting pseudoThreading tests to work

This commit is contained in:
2023-10-15 13:21:57 -04:00
parent ad929da484
commit ef7464f70d
14 changed files with 1150 additions and 28 deletions
+5 -3
View File
@@ -35,15 +35,16 @@ end
function multi:newSystemThreadedQueue(name)
local c = {}
c.data = {}
c.Type = multi.registerType("s_queue")
function c:push(v)
table.insert(self,v)
end
function c:pop()
return table.remove(self,1)
return table.remove(self.data,1)
end
function c:peek()
return self[1]
return self.data[1]
end
function c:init()
return self
@@ -156,6 +157,7 @@ function multi:newSystemThreadedJobQueue(n)
end)
for i=1,c.cores do
multi:newSystemThread("JobQueue_"..jqc.."_worker_"..i,function(jqc)
local GLOBAL, THREAD = require("multi.integration.pseudoManager"):init()
local multi, thread = require("multi"):init()
local clock = os.clock
local funcs = THREAD.waitFor("__JobQueue_"..jqc.."_table")
@@ -197,7 +199,7 @@ function multi:newSystemThreadedJobQueue(n)
end)
end
end
end).OnError(multi.error)
end)
thread:newThread("Idler",function()
while true do
thread.yield()
+1
View File
@@ -92,6 +92,7 @@ function multi:newSystemThread(name, func, ...)
local th = thread:newISOThread(name, func, env, ...)
th.Type = multi.registerType("s_thread", "pseudoThreads")
th.OnError(multi.error)
id = id + 1