Fixed issue with opt_finding thread.hold
This commit is contained in:
parent
e5ac4d3d9e
commit
6abfb9c3d9
@ -1,4 +1,4 @@
|
||||
commands = [[
|
||||
lcommands = [[
|
||||
mkdir luajit && python -m hererocks -j 2.1.0-beta3 -r latest --patch --compat all ./luajit && set "PATH=G:\VSCWorkspace\multi\luajit\bin;%PATH%" && lua -v && luarocks install multi && luarocks install lanes
|
||||
mkdir lua5.1 && python -m hererocks -l 5.1 -r latest --patch --compat all ./lua5.1 && set "PATH=G:\VSCWorkspace\multi\luajit\bin;%PATH%" && lua -v && luarocks install multi && luarocks install lanes
|
||||
mkdir lua5.2 && python -m hererocks -l 5.2 -r latest --patch --compat all ./lua5.2 && set "PATH=G:\VSCWorkspace\multi\luajit\bin;%PATH%" && lua -v && luarocks install multi && luarocks install lanes
|
||||
|
||||
@ -935,7 +935,7 @@ function multi:newProcessor(name,nothread)
|
||||
else
|
||||
c.OnError = multi:newConnection()
|
||||
end
|
||||
|
||||
c.OnError(multi.print)
|
||||
|
||||
|
||||
function c:getThreads()
|
||||
@ -1157,23 +1157,6 @@ function thread.hold(n,opt)
|
||||
return rdy()
|
||||
end, nil, interval)
|
||||
elseif type(n) == "function" then
|
||||
if find_optimization then
|
||||
local cache = string.dump(n)
|
||||
local f_str = tostring(n)
|
||||
local good = true
|
||||
for i=1,#func_cache do
|
||||
if func_cache[i][1] == cache and func_cache[i][2] ~= f_str then
|
||||
if not func_cache[i][3] then
|
||||
multi.optConn:Fire("It's better to store a function to a variable than to use an anonymous function within the hold method!\n" .. debug.traceback())
|
||||
func_cache[i][3] = true
|
||||
end
|
||||
good = false
|
||||
end
|
||||
end
|
||||
if good then
|
||||
table.insert(func_cache, {cache, f_str})
|
||||
end
|
||||
end
|
||||
return yield(CMD, t_hold, n or dFunc, nil, interval)
|
||||
else
|
||||
error("Invalid argument passed to thread.hold(...)!")
|
||||
@ -1371,6 +1354,7 @@ function thread:newThread(name,func,...)
|
||||
c.isError = false
|
||||
c.OnError = multi:newConnection(true,nil,true)
|
||||
c.OnDeath = multi:newConnection(true,nil,true)
|
||||
c.OnError(multi.print)
|
||||
|
||||
function c:getName()
|
||||
return c.Name
|
||||
@ -2242,6 +2226,6 @@ multi:newThread(function()
|
||||
end
|
||||
-- Add more Overrides
|
||||
end
|
||||
end).OnError(print)
|
||||
end)
|
||||
|
||||
return multi
|
||||
@ -223,7 +223,7 @@ function multi:newSystemThreadedConnection(name)
|
||||
ping:Pause()
|
||||
multi.ForEach(self.links, function(link) -- Sync new connections
|
||||
link:push{self.PING}
|
||||
multi:newThread("pong Thread", pong, link, links)
|
||||
multi:newThread("pong Thread", pong, link, self.links)
|
||||
end)
|
||||
|
||||
thread.sleep(3)
|
||||
|
||||
@ -78,6 +78,9 @@ function multi:newSystemThread(name, func, ...)
|
||||
c.alive = true
|
||||
c.priority = THREAD.Priority_Normal
|
||||
local multi_settings = multi.defaultSettings
|
||||
for i,v in pairs(multi_settings) do
|
||||
print(i,v)
|
||||
end
|
||||
c.thread = lanes.gen("*",
|
||||
{
|
||||
globals={ -- Set up some globals
|
||||
|
||||
2
test.lua
2
test.lua
@ -1,6 +1,6 @@
|
||||
package.path = "./?/init.lua;?.lua;lua5.4/share/lua/5.4/?/init.lua;lua5.4/share/lua/5.4/?.lua;"--..package.path
|
||||
package.cpath = "lua5.4/lib/lua/5.4/?/core.dll;"--..package.cpath
|
||||
multi, thread = require("multi"):init{print=true}
|
||||
multi, thread = require("multi"):init{print=true,findopt=true}
|
||||
GLOBAL, THREAD = require("multi.integration.lanesManager"):init()
|
||||
multi:getOptimizationConnection()(function(msg)
|
||||
print(msg)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user