tiny changes
This commit is contained in:
parent
7126e28530
commit
3bbd63ba62
@ -5,9 +5,15 @@ Update 13.1.0 Bug fixes and some new features (Will upgrade version to 14.0.0 if
|
|||||||
Added:
|
Added:
|
||||||
- Connections:Lock() -- Prevents a connection object form being fired
|
- Connections:Lock() -- Prevents a connection object form being fired
|
||||||
- Connections:Unlock() -- Removes the restriction imposed by conn:Lock()
|
- Connections:Unlock() -- Removes the restriction imposed by conn:Lock()
|
||||||
|
-
|
||||||
|
|
||||||
Fixed:
|
Fixed:
|
||||||
- Minor bug with multi:newThread() in how names and functions were managed
|
- Minor bug with multi:newThread() in how names and functions were managed
|
||||||
|
- Major bug with the system thread handler. Saw healthy threads as dead ones
|
||||||
|
-
|
||||||
|
|
||||||
|
Changed:
|
||||||
|
- getTasksDetails("t"), the table varaiant, formats threads, and system threads in the same way that tasks are formatted
|
||||||
-
|
-
|
||||||
|
|
||||||
Update 13.0.0 Added some documentation, and some new features too check it out!
|
Update 13.0.0 Added some documentation, and some new features too check it out!
|
||||||
|
|||||||
@ -373,19 +373,18 @@ function multi:getTasksDetails(t)
|
|||||||
PriorityScheme = priorityTable[multi.defaultSettings.priority or 0],
|
PriorityScheme = priorityTable[multi.defaultSettings.priority or 0],
|
||||||
SystemLoad = multi.Round(load,2),
|
SystemLoad = multi.Round(load,2),
|
||||||
CyclesPerSecondPerTask = steps,
|
CyclesPerSecondPerTask = steps,
|
||||||
|
SystemThreadCount = #multi.SystemThreads
|
||||||
}
|
}
|
||||||
str.threads = {}
|
str.Threads = {}
|
||||||
str.systemthreads = {}
|
str.Systemthreads = {}
|
||||||
for i,v in pairs(self.Mainloop) do
|
for i,v in pairs(self.Mainloop) do
|
||||||
str[#str+1]={Type=v.Type,Name=v.Name,Uptime=os.clock()-v.creationTime,Priority=self.PriorityResolve[v.Priority],TID = i}
|
str[#str+1]={Type=v.Type,Name=v.Name,Uptime=os.clock()-v.creationTime,Priority=self.PriorityResolve[v.Priority],TID = i}
|
||||||
end
|
end
|
||||||
for i=1,#multi.scheduler.Threads do
|
for i=1,#multi.scheduler.Threads do
|
||||||
str.threads[multi.scheduler.Threads[i].Name]={Uptime = os.clock()-multi.scheduler.Threads[i].creationTime}
|
table.insert(str.Threads,{Uptime = os.clock()-multi.scheduler.Threads[i].creationTime,Name = multi.scheduler.Threads[i].Name})
|
||||||
end
|
end
|
||||||
if multi.canSystemThread then
|
|
||||||
for i=1,#multi.SystemThreads do
|
for i=1,#multi.SystemThreads do
|
||||||
str.systemthreads[multi.SystemThreads[i].Name]={Uptime = os.clock()-multi.SystemThreads[i].creationTime}
|
table.insert(str.Systemthreads,{Uptime = os.clock()-multi.SystemThreads[i].creationTime,Name = multi.SystemThreads[i].Name})
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|||||||
@ -135,6 +135,7 @@ function multi:newSystemThread(name,func,...)
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
c.Type="sthread"
|
c.Type="sthread"
|
||||||
c.creationTime = os.clock()
|
c.creationTime = os.clock()
|
||||||
|
c.alive = true
|
||||||
local THREAD_NAME=name
|
local THREAD_NAME=name
|
||||||
local function func2(...)
|
local function func2(...)
|
||||||
local multi = require("multi")
|
local multi = require("multi")
|
||||||
@ -151,6 +152,7 @@ function multi:newSystemThread(name,func,...)
|
|||||||
function c:kill()
|
function c:kill()
|
||||||
self.thread:cancel()
|
self.thread:cancel()
|
||||||
multi.print("Thread: '"..self.name.."' has been stopped!")
|
multi.print("Thread: '"..self.name.."' has been stopped!")
|
||||||
|
self.alive = false
|
||||||
end
|
end
|
||||||
table.insert(multi.SystemThreads,c)
|
table.insert(multi.SystemThreads,c)
|
||||||
c.OnError = multi:newConnection()
|
c.OnError = multi:newConnection()
|
||||||
@ -169,12 +171,16 @@ function multi.InitSystemThreadErrorHandler()
|
|||||||
local v,err,t=threads[i].thread:join(.001)
|
local v,err,t=threads[i].thread:join(.001)
|
||||||
if err then
|
if err then
|
||||||
if err:find("Thread was killed!") then
|
if err:find("Thread was killed!") then
|
||||||
|
print(err)
|
||||||
livingThreads[threads[i].Id] = {false,threads[i].Name}
|
livingThreads[threads[i].Id] = {false,threads[i].Name}
|
||||||
|
threads[i].alive = false
|
||||||
multi.OnSystemThreadDied:Fire(threads[i].Id)
|
multi.OnSystemThreadDied:Fire(threads[i].Id)
|
||||||
GLOBAL["__THREADS__"]=livingThreads
|
GLOBAL["__THREADS__"]=livingThreads
|
||||||
table.remove(threads,i)
|
table.remove(threads,i)
|
||||||
else
|
elseif err:find("stack traceback") then
|
||||||
|
print(err)
|
||||||
threads[i].OnError:Fire(threads[i],err,"Error in systemThread: '"..threads[i].name.."' <"..err..">")
|
threads[i].OnError:Fire(threads[i],err,"Error in systemThread: '"..threads[i].name.."' <"..err..">")
|
||||||
|
threads[i].alive = false
|
||||||
livingThreads[threads[i].Id] = {false,threads[i].Name}
|
livingThreads[threads[i].Id] = {false,threads[i].Name}
|
||||||
multi.OnSystemThreadDied:Fire(threads[i].Id)
|
multi.OnSystemThreadDied:Fire(threads[i].Id)
|
||||||
GLOBAL["__THREADS__"]=livingThreads
|
GLOBAL["__THREADS__"]=livingThreads
|
||||||
|
|||||||
17
test.lua
17
test.lua
@ -15,16 +15,29 @@ function table.print(tbl, indent)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
multi:newThread(function()
|
print(#multi.SystemThreads)
|
||||||
|
multi:newThread("Detail Updater",function()
|
||||||
while true do
|
while true do
|
||||||
thread.sleep(1)
|
thread.sleep(1)
|
||||||
|
print(multi:getTasksDetails())
|
||||||
print("-----")
|
print("-----")
|
||||||
multi:getTasksDetails("t")
|
table.print(multi:getTasksDetails("t"))
|
||||||
|
io.read()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
multi.OnSystemThreadDied(function(...)
|
||||||
|
print("why you say dead?",...)
|
||||||
|
end)
|
||||||
multi.OnError(function(...)
|
multi.OnError(function(...)
|
||||||
print(...)
|
print(...)
|
||||||
end)
|
end)
|
||||||
|
multi:newSystemThread("TestSystem",function()
|
||||||
|
while true do
|
||||||
|
THREAD.sleep(1)
|
||||||
|
print("I'm alive")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
print(#multi.SystemThreads)
|
||||||
multi:mainloop{
|
multi:mainloop{
|
||||||
protect = false,
|
protect = false,
|
||||||
print = true
|
print = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user