V15.3.0 #46
@ -16,6 +16,9 @@ Added:
|
||||
- multi:newProcessor(name,nothread).run()
|
||||
- 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
|
||||
- `TLoop:Set(set)` - Sets the time to wait for the TLoop
|
||||
|
||||
@ -28,7 +31,9 @@ Added:
|
||||
|
||||
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.
|
||||
|
||||
- multi:mainloop(~~settings~~)/multi:uManager(~~settings~~) no longer takes a settings argument, that has been moved to multi:init(settings)
|
||||
| Setting | Description |
|
||||
---|---
|
||||
|
||||
@ -948,6 +948,11 @@ function multi:newProcessor(name,nothread)
|
||||
in_proc = false
|
||||
return t
|
||||
end
|
||||
function c:newFunction(func,holdme)
|
||||
return thread:newFunctionBase(function(...)
|
||||
return c:newThread("TempThread",func,...)
|
||||
end,holdme)()
|
||||
end
|
||||
function c.run()
|
||||
c.pump = true
|
||||
c:uManager()
|
||||
|
||||
27
test4.lua
27
test4.lua
@ -15,25 +15,22 @@ proc = multi:newProcessor("Test")
|
||||
|
||||
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.sleep(5)
|
||||
thread.sleep(3.1)
|
||||
proc.Stop()
|
||||
thread.sleep(5)
|
||||
thread.sleep(3)
|
||||
proc.Start()
|
||||
end)
|
||||
|
||||
thread:newThread(function()
|
||||
while true do
|
||||
thread.sleep(1)
|
||||
print("...")
|
||||
end
|
||||
end)
|
||||
|
||||
proc:newThread(function()
|
||||
while true do
|
||||
thread.sleep(1)
|
||||
print("Testing...")
|
||||
end
|
||||
end)
|
||||
func("Some","tests","needed")
|
||||
|
||||
multi:mainloop()
|
||||
Loading…
x
Reference in New Issue
Block a user