end
elseif stat == 0 then
ifaddrs = nixio.getifaddrs()
- collectgarbage("collect")
end
for _, cb in ipairs(tickt) do
local pid, stat, code = nixio.wait(-1, "nohang")
while pid and pid > 0 do
- tcount = tcount - 1
- if tpids[pid] and tpids[pid] ~= true then
- tpids[pid](pid, stat, code)
+ nixio.syslog("info", "Buried thread: " .. pid)
+ if tpids[pid] then
+ tcount = tcount - 1
+ if tpids[pid] ~= true then
+ tpids[pid](pid, stat, code)
+ end
+ tpids[pid] = nil
end
pid, stat, code = nixio.wait(-1, "nohang")
end
if threadlimit and tcount >= threadlimit then
nixio.syslog("warning", "Cannot create thread: process limit reached")
return nil
+ else
+ collectgarbage("collect")
end
local pid, code, err = nixio.fork()
if pid and pid ~= 0 then
- tpids[pid] = waitcb
+ nixio.syslog("info", "Created thread: " .. pid)
+ tpids[pid] = waitcb or true
tcount = tcount + 1
elseif pid == 0 then
local code = threadcb()