Skip to content

Instantly share code, notes, and snippets.

View yujiang's full-sized avatar

yujiang yujiang

  • china
View GitHub Profile
@yujiang
yujiang / gist:6080628
Last active December 20, 2015 05:48
reuse Lua's coroutine
--coroutine pool
local freelist={};
function find_free(f)
if #freelist > 0 then
local free = freelist[#freelist]
table.remove(freelist)
return {thread = free,func = f,status="create"}
end
end