cqueues is a
library which (presumably) does the same sort of thing.
It’s well documented and avoids callback hell by using coroutines
everywhere. It also provides a sane concurrency library with support
for message passing concurrency! The syntax is a little noisy, but Lua
is often like that. A crappy example:
local cqueues = require( "cqueues" )
local thread = require( "cqueues.thread" )
local cq = cqueues.new()
thread.start( function()
local cqueues = require( "cqueues" )
local cq = cqueues.new()
cq:wrap( function()
local i = 0
while true do
if i % 1000000 == 0 then
print( "I'm counting: " .. i )
end
i = i + 1
end
end )
cq:loop()
end )
cq:wrap( function()
while true do
print( "I'm not blocked!" )
cqueues.sleep( 0.75 )
end
end )
cq:loop()
Announcement with more details can be found here : http://permalink.gmane.org/gmane.comp.lang.lua.general/116266
cqueues is a library which (presumably) does the same sort of thing.
It’s well documented and avoids callback hell by using coroutines everywhere. It also provides a sane concurrency library with support for message passing concurrency! The syntax is a little noisy, but Lua is often like that. A crappy example: