mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
fix typo: coroutine_pool
This commit is contained in:
@@ -30,17 +30,17 @@ local trace_func = function() end
|
|||||||
|
|
||||||
-- coroutine reuse
|
-- coroutine reuse
|
||||||
|
|
||||||
local coroutine_poll = {}
|
local coroutine_pool = {}
|
||||||
local coroutine_yield = coroutine.yield
|
local coroutine_yield = coroutine.yield
|
||||||
|
|
||||||
local function co_create(f)
|
local function co_create(f)
|
||||||
local co = table.remove(coroutine_poll)
|
local co = table.remove(coroutine_pool)
|
||||||
if co == nil then
|
if co == nil then
|
||||||
co = coroutine.create(function(...)
|
co = coroutine.create(function(...)
|
||||||
f(...)
|
f(...)
|
||||||
while true do
|
while true do
|
||||||
f = nil
|
f = nil
|
||||||
coroutine_poll[#coroutine_poll] = co
|
coroutine_pool[#coroutine_pool] = co
|
||||||
f = coroutine_yield "EXIT"
|
f = coroutine_yield "EXIT"
|
||||||
f(coroutine_yield())
|
f(coroutine_yield())
|
||||||
end
|
end
|
||||||
@@ -481,7 +481,7 @@ function dbgcmd.MEM()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function dbgcmd.GC()
|
function dbgcmd.GC()
|
||||||
coroutine_poll = {}
|
coroutine_pool = {}
|
||||||
collectgarbage "collect"
|
collectgarbage "collect"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user