This commit is contained in:
Ryan Ward 2020-03-12 15:07:58 -04:00
parent 5d363f4fa7
commit 2d281fae90
2 changed files with 35 additions and 37 deletions

View File

@ -24,7 +24,7 @@ Current Multi Version: 14.2.0
**Note:** Most settings have been fined tuned to be at the peak of performance already, however preLoop, protect (Which drastically lowers preformance), and stopOnError should be used freely to fit your needs. **Note:** Most settings have been fined tuned to be at the peak of performance already, however preLoop, protect (Which drastically lowers preformance), and stopOnError should be used freely to fit your needs.
| Setting | Type: default | Purpose | | Setting | Type: default | Purpose |
|-|-|-| | --------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| preLoop | function: nil | This is a function that is called after all the important components of the library are loaded. This is called once only. The first and only argument passed is a reference to itself. | | preLoop | function: nil | This is a function that is called after all the important components of the library are loaded. This is called once only. The first and only argument passed is a reference to itself. |
| protect | boolean: false | This runs code within a protected call. To catch when errors happen see built in connections | | protect | boolean: false | This runs code within a protected call. To catch when errors happen see built in connections |
| stopOnError | boolean: false | This setting is used with protect. If an object crashes due to some error should it be paused? | | stopOnError | boolean: false | This setting is used with protect. If an object crashes due to some error should it be paused? |
@ -39,7 +39,7 @@ Current Multi Version: 14.2.0
P1 follows a forumla that resembles this: ~n=I*PRank</br>Where **n** is the amount of steps given to an object with PRank and where I is the idle time see chart below. The aim of this priority scheme was to make core objects run fastest while letting idle processes get decent time as well. P1 follows a forumla that resembles this: ~n=I*PRank</br>Where **n** is the amount of steps given to an object with PRank and where I is the idle time see chart below. The aim of this priority scheme was to make core objects run fastest while letting idle processes get decent time as well.
| Priority: n | PRank | Formula | | Priority: n | PRank | Formula |
|-|-|-| | --------------------- | ----- | ------------ |
| Core: 3322269 | 7 | n = ~**I***7 | | Core: 3322269 | 7 | n = ~**I***7 |
| High: 2847660 | 6 | n = ~**I***6 | | High: 2847660 | 6 | n = ~**I***6 |
| Above_Normal: 2373050 | 5 | n = ~**I***5 | | Above_Normal: 2373050 | 5 | n = ~**I***5 |
@ -228,7 +228,17 @@ multi:lightloop()
``` ```
As mentioned above this is made much easier using threads As mentioned above this is made much easier using threads
```lua ```lua
package.path="?.lua;?/init.lua;?.lua;?/?/init.lua;"..package.path
multi, thread = require("multi"):init()
func = thread:newFunction(function(a)
return thread.holdFor(3,function()
return a==5 and "This is returned" -- Condition being tested!
end)
end,true)
print(func(5))
print(func(0))
-- You actually do not need the light/mainloop or any runner for threaded functions to work
--multi:lightloop()
``` ```
# Semi-Actors: scheduleJob # Semi-Actors: scheduleJob

View File

@ -1,23 +1,11 @@
package.path="?.lua;?/init.lua;?.lua;?/?/init.lua;"..package.path package.path="?.lua;?/init.lua;?.lua;?/?/init.lua;"..package.path
multi, thread = require("multi"):init() multi, thread = require("multi"):init()
a=0 func = thread:newFunction(function(a)
local function cleanReturns(...)
local n = select("#", ...)
print(n)
local returns = {...}
local rets = {}
local ind = 0
for i=n,1,-1 do
if returns[i] then
ind=i
end
end
return unpack(returns,1,ind)
end
func = thread:newFunction(function()
return thread.holdFor(3,function() return thread.holdFor(3,function()
return a==5 -- Condition being tested! return a==5 and "This is returned" -- Condition being tested!
end) end)
end,true) end,true)
print(func()) print(func(5))
print(func(0))
-- You actually do not need the light/mainloop or any runner for threaded functions to work
--multi:lightloop() --multi:lightloop()