diff --git a/changes.md b/changes.md index 4ed1957..a32b0d9 100644 --- a/changes.md +++ b/changes.md @@ -13,6 +13,8 @@ Full Update Showcase Added: --- +- multi:getThreads() + - Returns a list of all threads on a process - multi:newProcessor(name,nothread).run() - new function run to the processor object to diff --git a/multi/init.lua b/multi/init.lua index 06699fd..a59587b 100644 --- a/multi/init.lua +++ b/multi/init.lua @@ -943,6 +943,9 @@ function multi:newProcessor(name,nothread) c.process.isProcessThread = true c.process.PID = sandcount c.OnError = c.process.OnError + function c:getThreads() + return self.threads + end function c:newThread(name,func,...) in_proc = c local t = thread.newThread(c,name,func,...) @@ -1027,6 +1030,10 @@ local resume, status, create, yield, running = coroutine.resume, coroutine.statu local t_hold, t_sleep, t_holdF, t_skip, t_holdW, t_yield, t_none = 1, 2, 3, 4, 5, 6, 7 +function multi:getThreads() + return threads +end + function thread.request(t,cmd,...) thread.requests[t.thread] = {cmd,{...}} end diff --git a/test.lua b/test.lua index 5ed2e58..4662f1d 100644 --- a/test.lua +++ b/test.lua @@ -1,27 +1,8 @@ package.path = "./?/init.lua;"..package.path multi, thread = require("multi"):init() -func = thread:newFunction(function(count) - local a = 0 - while true do - a = a + 1 - thread.sleep(.1) - thread.pushStatus(a,count) - if a == count then break end - end - return "Done", 1, 2, 3 -end) - -thread:newThread("test",function() - local ret = func(10) - ret.OnStatus(function(part,whole) - print("Ret1: ",math.ceil((part/whole)*1000)/10 .."%") - end) - print("Status:",thread.hold(ret.OnReturn)) - print("Function Done!") - os.exit() -end).OnError(function(...) - print("Error:",...) -end) +function multi:getTaskStats() + local stats = {} +end multi:mainloop() \ No newline at end of file