projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
644bc4a
)
libs/lucid: only execute handlers if daemon is below the thread limit, this allows...
author
Jo-Philipp Wich
<jow@openwrt.org>
Mon, 6 Jul 2009 22:26:46 +0000
(22:26 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Mon, 6 Jul 2009 22:26:46 +0000
(22:26 +0000)
libs/lucid/luasrc/lucid.lua
patch
|
blob
|
history
diff --git
a/libs/lucid/luasrc/lucid.lua
b/libs/lucid/luasrc/lucid.lua
index b10365579a043e75108700405be4141212d19d3d..4963ccc30485b424c014235f986a35b6e0cfb67e 100644
(file)
--- a/
libs/lucid/luasrc/lucid.lua
+++ b/
libs/lucid/luasrc/lucid.lua
@@
-110,19
+110,22
@@
end
-- This main function of LuCId will wait for events on given file descriptors.
function run()
local pollint = tonumber((cursor:get(UCINAME, "main", "pollinterval")))
-- 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
while true do
- local stat, code = nixio.poll(pollt, pollint)
+ if not threadlimit or tcount < threadlimit then
+ local stat, code = nixio.poll(pollt, pollint)
- if stat and stat > 0 then
- for _, polle in ipairs(pollt) do
- if polle.revents ~= 0 and polle.handler then
- polle.handler(polle)
+ if stat and stat > 0 then
+ for _, polle in ipairs(pollt) do
+ if polle.revents ~= 0 and polle.handler then
+ polle.handler(polle)
+ end
end
end
+ elseif stat == 0 then
+ ifaddrs = nixio.getifaddrs()
+ collectgarbage("collect")
end
end
- elseif stat == 0 then
- ifaddrs = nixio.getifaddrs()
- collectgarbage("collect")
end
for _, cb in ipairs(tickt) do
end
for _, cb in ipairs(tickt) do
@@
-317,4
+320,4
@@
function daemonize()
nixio.dup(devnull, nixio.stderr)
return true
nixio.dup(devnull, nixio.stderr)
return true
-end
\ No newline at end of file
+end