add message overload warning

This commit is contained in:
Cloud Wu
2014-10-08 22:42:01 +08:00
parent 535bbc7219
commit 2f6bfe9104
5 changed files with 88 additions and 3 deletions

View File

@@ -95,6 +95,7 @@ end
local coroutine_pool = {}
local coroutine_yield = coroutine.yield
local coroutine_count = 0
local function co_create(f)
local co = table.remove(coroutine_pool)
@@ -109,6 +110,11 @@ local function co_create(f)
f(coroutine_yield())
end
end)
coroutine_count = coroutine_count + 1
if coroutine_count > 1024 then
skynet.error("May overload, create 1024 task")
coroutine_count = 0
end
else
coroutine.resume(co, f)
end