libs/lucid: only execute handlers if daemon is below the thread limit, this allows to hold connections without having to fork immediately

This commit is contained in:
Jo-Philipp Wich 2009-07-06 22:26:46 +00:00
parent 644bc4ac3a
commit 238404ee83

View file

@ -110,8 +110,10 @@ end
-- This main function of LuCId will wait for events on given file descriptors.
function run()
local pollint = tonumber((cursor:get(UCINAME, "main", "pollinterval")))
local threadlimit = tonumber(cursor:get(UCINAME, "main", "threadlimit"))
while true do
if not threadlimit or tcount < threadlimit then
local stat, code = nixio.poll(pollt, pollint)
if stat and stat > 0 then
@ -124,6 +126,7 @@ function run()
ifaddrs = nixio.getifaddrs()
collectgarbage("collect")
end
end
for _, cb in ipairs(tickt) do
cb()