V15.3.0 #46

Merged
rayaman merged 85 commits from v15.3.0 into network_parallelism_test_branch 2022-06-11 23:41:07 -04:00
3 changed files with 22 additions and 15 deletions
Showing only changes of commit 2acce5001d - Show all commits

View File

@ -16,6 +16,9 @@ Added:
- multi:newProcessor(name,nothread).run() - multi:newProcessor(name,nothread).run()
- new function run to the processor object to - new function run to the processor object to
- multi:newProcessor(name,nothread):newFunction(func,holdme)
- Acts like thread:newFunction(), but binds the execution of that threaded function to the processor
- multi:newTLoop() member functions - multi:newTLoop() member functions
- `TLoop:Set(set)` - Sets the time to wait for the TLoop - `TLoop:Set(set)` - Sets the time to wait for the TLoop
@ -28,7 +31,9 @@ Added:
Changed: Changed:
--- ---
- Modified how threads are handled internally. This changes makes it so threads "regardless of amount" should not impact performance. What you do in the threads might. This change was made by internally only processing one thread per step per processor. If you have 10 processors that are all active expect one step to process 10 threads. However if one processor has 10 threads each step will only process one thread. Simply put each addition of a thread shouldn't impact performance as it did before.
- Moved `multi:newThread(...)` into the thread interface (`thread:newThread(...)`), code using `multi:newThread(...)` will still work. Also using `process:newThread(...)` binds the thread to the process, meaning if the process the thread is bound to is paused so is the thread. - Moved `multi:newThread(...)` into the thread interface (`thread:newThread(...)`), code using `multi:newThread(...)` will still work. Also using `process:newThread(...)` binds the thread to the process, meaning if the process the thread is bound to is paused so is the thread.
- multi:mainloop(~~settings~~)/multi:uManager(~~settings~~) no longer takes a settings argument, that has been moved to multi:init(settings) - multi:mainloop(~~settings~~)/multi:uManager(~~settings~~) no longer takes a settings argument, that has been moved to multi:init(settings)
| Setting | Description | | Setting | Description |
---|--- ---|---

View File

@ -948,6 +948,11 @@ function multi:newProcessor(name,nothread)
in_proc = false in_proc = false
return t return t
end end
function c:newFunction(func,holdme)
return thread:newFunctionBase(function(...)
return c:newThread("TempThread",func,...)
end,holdme)()
end
function c.run() function c.run()
c.pump = true c.pump = true
c:uManager() c:uManager()

View File

@ -15,25 +15,22 @@ proc = multi:newProcessor("Test")
proc.Start() proc.Start()
local func = proc:newFunction(function(a,b,c)
print("Testing proc functions!",a,b,c)
for i=1,10 do
thread.sleep(1)
print("h1")
end
return true,"Smile"
end)
thread:newThread(function() thread:newThread(function()
thread.sleep(5) thread.sleep(3.1)
proc.Stop() proc.Stop()
thread.sleep(5) thread.sleep(3)
proc.Start() proc.Start()
end) end)
thread:newThread(function() func("Some","tests","needed")
while true do
thread.sleep(1)
print("...")
end
end)
proc:newThread(function()
while true do
thread.sleep(1)
print("Testing...")
end
end)
multi:mainloop() multi:mainloop()