diff --git a/examples/checkdeadloop.lua b/examples/checkdeadloop.lua new file mode 100644 index 00000000..46f395c1 --- /dev/null +++ b/examples/checkdeadloop.lua @@ -0,0 +1,30 @@ +local skynet = require "skynet" + +local list = {} + +local function timeout_check(ti) + if not next(list) then + return + end + skynet.sleep(ti) -- sleep 10 sec + for k,v in pairs(list) do + skynet.error("timout",ti,k,v) + end +end + +skynet.start(function() + skynet.error("ping all") + local list_ret = skynet.call(".launcher", "lua", "LIST") + for addr, desc in pairs(list_ret) do + list[addr] = desc + skynet.fork(function() + skynet.call(addr,"debug","INFO") + list[addr] = nil + end) + end + skynet.sleep(0) + timeout_check(100) + timeout_check(400) + timeout_check(500) + skynet.exit() +end)