Working on priority management
This commit is contained in:
parent
03dbe1ee5b
commit
42149ffab2
@ -204,6 +204,7 @@ Added
|
|||||||
|
|
||||||
Changed
|
Changed
|
||||||
---
|
---
|
||||||
|
- multi.OnObjectCreated is only called when an object is created in a particular process. Proc.OnObjectCreated is needed to detect when an object is created within a process.
|
||||||
- multi.print shows "INFO" before it's message.
|
- multi.print shows "INFO" before it's message.
|
||||||
- Connections internals changed, not too much changed on the surface.
|
- Connections internals changed, not too much changed on the surface.
|
||||||
- newConnection(protect, func, kill)
|
- newConnection(protect, func, kill)
|
||||||
|
|||||||
21
init.lua
21
init.lua
@ -402,7 +402,7 @@ function multi:newConnection(protect, func, kill)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not(ignoreconn) then
|
if not(ignoreconn) then
|
||||||
multi:create(c)
|
self:create(c)
|
||||||
end
|
end
|
||||||
|
|
||||||
return c
|
return c
|
||||||
@ -638,7 +638,7 @@ function multi:newTimer()
|
|||||||
time=os.clock()-time
|
time=os.clock()-time
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
multi:create(c)
|
self:create(c)
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -662,7 +662,7 @@ function multi:newEvent(task)
|
|||||||
c.OnEvent = self:newConnection():fastMode()
|
c.OnEvent = self:newConnection():fastMode()
|
||||||
self:setPriority("core")
|
self:setPriority("core")
|
||||||
c:setName(c.Type)
|
c:setName(c.Type)
|
||||||
multi:create(c)
|
self:create(c)
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -684,7 +684,7 @@ function multi:newUpdater(skip)
|
|||||||
end
|
end
|
||||||
c.OnUpdate = self:newConnection():fastMode()
|
c.OnUpdate = self:newConnection():fastMode()
|
||||||
c:setName(c.Type)
|
c:setName(c.Type)
|
||||||
multi:create(c)
|
self:create(c)
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ function multi:newAlarm(set)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
c:setName(c.Type)
|
c:setName(c.Type)
|
||||||
multi:create(c)
|
self:create(c)
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -744,7 +744,7 @@ function multi:newLoop(func,notime)
|
|||||||
c.OnLoop(func)
|
c.OnLoop(func)
|
||||||
end
|
end
|
||||||
|
|
||||||
multi:create(c)
|
self:create(c)
|
||||||
c:setName(c.Type)
|
c:setName(c.Type)
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
@ -804,7 +804,7 @@ function multi:newStep(start,reset,count,skip)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
c:setName(c.Type)
|
c:setName(c.Type)
|
||||||
multi:create(c)
|
self:create(c)
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -840,7 +840,7 @@ function multi:newTLoop(func,set)
|
|||||||
c.OnLoop(func)
|
c.OnLoop(func)
|
||||||
end
|
end
|
||||||
c:setName(c.Type)
|
c:setName(c.Type)
|
||||||
multi:create(c)
|
self:create(c)
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -890,7 +890,7 @@ function multi:newTStep(start,reset,count,set)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
c:setName(c.Type)
|
c:setName(c.Type)
|
||||||
multi:create(c)
|
self:create(c)
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -979,6 +979,7 @@ function multi:newProcessor(name, nothread)
|
|||||||
c.threads = {}
|
c.threads = {}
|
||||||
c.startme = {}
|
c.startme = {}
|
||||||
c.parent = self
|
c.parent = self
|
||||||
|
c.OnObjectCreated = multi:newConnection()
|
||||||
|
|
||||||
local handler = c:createHandler(c)
|
local handler = c:createHandler(c)
|
||||||
|
|
||||||
@ -1449,7 +1450,7 @@ function thread:newThread(name, func, ...)
|
|||||||
|
|
||||||
globalThreads[c] = multi
|
globalThreads[c] = multi
|
||||||
threadid = threadid + 1
|
threadid = threadid + 1
|
||||||
multi:create(c)
|
self:create(c)
|
||||||
c.creationTime = os.clock()
|
c.creationTime = os.clock()
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|||||||
@ -27,17 +27,12 @@ local uManagerRefP = multi.uManagerRefP1
|
|||||||
|
|
||||||
-- self:setCurrentProcess() a bit slower than using the local var, but there isn't another option
|
-- self:setCurrentProcess() a bit slower than using the local var, but there isn't another option
|
||||||
|
|
||||||
-- function multi:uManagerRef()
|
local priorityManager = multi:newProcessor("Priority Manager", true)
|
||||||
-- if self.Active then
|
|
||||||
-- self:setCurrentProcess()
|
local function processHook(obj, proc)
|
||||||
-- local Loop=self.Mainloop
|
obj.__restoreProc = proc
|
||||||
-- for _D=#Loop,1,-1 do
|
obj:reallocate(priorityManager)
|
||||||
-- __CurrentTask = Loop[_D]
|
end
|
||||||
-- __CurrentTask:Act()
|
|
||||||
-- self:setCurrentProcess()
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
local function init()
|
local function init()
|
||||||
local RR, PB, TB = 0, 1, 2
|
local RR, PB, TB = 0, 1, 2
|
||||||
@ -67,7 +62,12 @@ local function init()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function init_chronos()
|
local function init_chronos()
|
||||||
|
multi:newThread("Priority Manager", function()
|
||||||
|
while true do
|
||||||
|
thread.yield()
|
||||||
|
priorityManager.run()
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
if chronos then
|
if chronos then
|
||||||
|
|||||||
@ -1,13 +1,5 @@
|
|||||||
package.path = "../?/init.lua;../?.lua;"..package.path
|
package.path = "../?/init.lua;../?.lua;"..package.path
|
||||||
multi, thread = require("multi"):init{print=true,findopt=true}
|
multi, thread = require("multi"):init{print=true,findopt=true}
|
||||||
|
require("multi.integration.priorityManager")
|
||||||
|
|
||||||
local conn1 = multi:newConnection()
|
multi:mainloop()
|
||||||
local conn2 = function(a,b,c) return a*2, b*2, c*2 end % conn1
|
|
||||||
conn2(function(a,b,c)
|
|
||||||
print("Conn2",a,b,c)
|
|
||||||
end)
|
|
||||||
conn1(function(a,b,c)
|
|
||||||
print("Conn1",a,b,c)
|
|
||||||
end)
|
|
||||||
conn1:Fire(1,2,3)
|
|
||||||
conn2:Fire(1,2,3)
|
|
||||||
Loading…
x
Reference in New Issue
Block a user