X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Flucid%2Fluasrc%2Flucid.lua;fp=libs%2Flucid%2Fluasrc%2Flucid.lua;h=7a9c4abdfd2f6668cab415b0010d8f782d40aa64;hp=e1d73227f1cc4ca8c5bdce63fe4d39df688fdb4b;hb=c45930e05e7de9fcb572c063fb503e6c98e53272;hpb=45e20225a51f66b8ba001c98a2c534bc251143ee diff --git a/libs/lucid/luasrc/lucid.lua b/libs/lucid/luasrc/lucid.lua index e1d73227f1..7a9c4abdfd 100644 --- a/libs/lucid/luasrc/lucid.lua +++ b/libs/lucid/luasrc/lucid.lua @@ -145,9 +145,11 @@ function run() 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) + if tpids[pid] then + tcount = tcount - 1 + if tpids[pid] ~= true then + tpids[pid](pid, stat, code) + end end pid, stat, code = nixio.wait(-1, "nohang") end @@ -231,7 +233,7 @@ function create_process(threadcb, waitcb) end local pid, code, err = nixio.fork() if pid and pid ~= 0 then - tpids[pid] = waitcb + tpids[pid] = waitcb or true tcount = tcount + 1 elseif pid == 0 then local code = threadcb()