v13.0.0 #11

Merged
rayaman merged 20 commits from v13.0.0 into master 2019-03-22 21:21:37 -04:00
6 changed files with 51 additions and 12 deletions
Showing only changes of commit 41725dc01f - Show all commits

View File

@ -1003,7 +1003,7 @@ multi:SystemThreadedBenchmark(1).OnBench(function(...)
end) end)
multi:mainloop() multi:mainloop()
``` ```
ST - SystemThreadedExecute ST - SystemThreadedExecute WIP* Might remove
-------------------------- --------------------------
Network Threads - Multi-Integration Network Threads - Multi-Integration

View File

@ -1,6 +1,6 @@
#Changes #Changes
[TOC] [TOC]
Update 13.0.0 So you documented it, finally! New additions/changes/ and fixes Update 13.0.0 So you documented it, finally! If I had a dollar for each time I found a bug working on 13.0.0 I'd be quite wealthy by now. How much lag could one expect when I've been coding with my own library wrong this entire time?
------------- -------------
Fixed: Tons of bugs, I actually went through the entire library and did a full test of everything, I mean everything, while writing the documentation. Fixed: Tons of bugs, I actually went through the entire library and did a full test of everything, I mean everything, while writing the documentation.
Changed: Changed:
@ -48,6 +48,9 @@ Fixed:
- There were some bugs in the networkmanager.lua file. Desrtoy -> Destroy some misspellings. - There were some bugs in the networkmanager.lua file. Desrtoy -> Destroy some misspellings.
- Massive object management bugs which caused performance to drop like a rock. Remember to Destroy objects when no longer using them. I should probably start working on a garbage collector for these objects! - Massive object management bugs which caused performance to drop like a rock. Remember to Destroy objects when no longer using them. I should probably start working on a garbage collector for these objects!
- Found a bug with processors not having the Destroy() function implemented properly. - Found a bug with processors not having the Destroy() function implemented properly.
- Found an issue with the rockspec which is due to the networkManager additon. The net Library and the multi Library are now codependent if using that feature. Going forward you will have to now install the network library separately
- Insane proformance bug found in the networkManager file, where each connection to a node created a new thread (VERY BAD) If say you connected to 100s of threads, you would lose a lot of processing power due to a bad implementation of this feature. But it goes futhur than this, the net library also creates a new thread for each connection made, so times that initial 100 by about 3, you end up with a system that quickly eats itself. I have to do tons of rewriting of everything. Yet another setback for the 13.0.0 release
- Fixed an issue where any argument greater than 256^2/65536 bytes is sent the networkmanager would soft crash. This was fixed by increading the limit to 256^4/4294967296 bytes. The fix was changing a 2 to a 4. Arguments greater than 256^4 would be impossible in 32 bit lua, and highly unlikely even in lua 64 bit. Perhaps someone is reading an entire file into ram and then sending the entire file that they read over a socket for some reason all at once!?
Added: Added:
- multi:newHyperThreadedProcess(STRING name) -- This is a version of the threaded process that gives each object created its own coroutine based thread which means you can use thread.* without affecting other objects created within the hyper threaded processes. - multi:newHyperThreadedProcess(STRING name) -- This is a version of the threaded process that gives each object created its own coroutine based thread which means you can use thread.* without affecting other objects created within the hyper threaded processes.

View File

@ -1808,6 +1808,7 @@ function multi:mainloop(settings)
local solid local solid
local sRef local sRef
while mainloopActive do while mainloopActive do
--print(mainloopActive)
if ncount ~= 0 then if ncount ~= 0 then
for i = 1, ncount do for i = 1, ncount do
next[i]() next[i]()

View File

@ -287,7 +287,7 @@ function multi:newNode(settings)
local temp = bin.new(dat) local temp = bin.new(dat)
local len = temp:getBlock("n",1) local len = temp:getBlock("n",1)
local name = temp:getBlock("s",len) local name = temp:getBlock("s",len)
len = temp:getBlock("n",2) len = temp:getBlock("n",4)
local args = temp:getBlock("s",len) local args = temp:getBlock("s",len)
_G[name](unpack(resolveData(args))) _G[name](unpack(resolveData(args)))
elseif cmd == CMD_TASK then elseif cmd == CMD_TASK then
@ -356,7 +356,7 @@ function multi:newMaster(settings) -- You will be able to have more than one mas
if settings.managerDetails then if settings.managerDetails then
local client = net:newTCPClient(settings.managerDetails[1],settings.managerDetails[2]) local client = net:newTCPClient(settings.managerDetails[1],settings.managerDetails[2])
if not client then if not client then
print("Cannot connect to the node manager! Ensuring broadcast listening is enabled!") settings.noBroadCast = false print("Warning: Cannot connect to the node manager! Ensuring broadcast listening is enabled!") settings.noBroadCast = false
else else
client.OnDataRecieved(function(client,data) client.OnDataRecieved(function(client,data)
local cmd = data:sub(1,1) local cmd = data:sub(1,1)
@ -406,7 +406,7 @@ function multi:newMaster(settings) -- You will be able to have more than one mas
temp:addBlock(CMD_CALL,1) temp:addBlock(CMD_CALL,1)
temp:addBlock(#name,1) temp:addBlock(#name,1)
temp:addBlock(name,#name) temp:addBlock(name,#name)
temp:addBlock(#args,2) temp:addBlock(#args,4)
temp:addBlock(args,#args) temp:addBlock(args,#args)
master:sendTo(node,temp.data) master:sendTo(node,temp.data)
end end

View File

@ -0,0 +1,31 @@
package = "multi"
version = "13.0-0"
source = {
url = "git://github.com/rayaman/multi.git",
tag = "v13.0.0",
}
description = {
summary = "Lua Multi tasking library",
detailed = [[
This library contains many methods for multi tasking. From simple side by side code using multi-objs, to using coroutine based Threads and System threads(When you have lua lanes installed or are using love2d)
]],
homepage = "https://github.com/rayaman/multi",
license = "MIT"
}
dependencies = {
"lua >= 5.1",
"bin",
"lanes",
}
build = {
type = "builtin",
modules = {
["multi.init"] = "multi/init.lua",
["multi.compat.love2d"] = "multi/compat/love2d.lua",
["multi.integration.lanesManager"] = "multi/integration/lanesManager.lua",
["multi.integration.loveManager"] = "multi/integration/loveManager.lua",
["multi.integration.luvitManager"] = "multi/integration/luvitManager.lua",
["multi.integration.networkManager"] = "multi/integration/networkManager.lua",
["multi.integration.shared"] = "multi/integration/shared.lua"
}
}

View File

@ -14,18 +14,22 @@ end
master = multi:newMaster{ master = multi:newMaster{
name = "Main", -- the name of the master name = "Main", -- the name of the master
--noBroadCast = true, -- if using the node manager, set this to true to avoid double connections --noBroadCast = true, -- if using the node manager, set this to true to avoid double connections
managerDetails = {"192.168.1.4",12345}, -- the details to connect to the node manager (ip,port) --~ managerDetails = {"192.168.1.4",12345}, -- the details to connect to the node manager (ip,port)
} }
master.OnError(function(name,err) master.OnError(function(name,err)
print(name.." has encountered an error: "..err) print(name.." has encountered an error: "..err)
end) end)
master.OnNodeConnected(function(name) local connlist = {}
multi:newThread("Main Thread Data Sender",function() multi:newThread("NodeUpdater",function()
while true do while true do
thread.sleep(.5) thread.sleep(1)
conn = master:execute("TASK_MAN",name, multi:getTasksDetails()) for i=1,#connlist do
conn = master:execute("TASK_MAN",connlist[i], multi:getTasksDetails())
end end
end,5) end
end)
master.OnNodeConnected(function(name)
table.insert(connlist,name)
end) end)
multi.OnError(function(...) multi.OnError(function(...)
print(...) print(...)