lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>From the README:

Lumen: Lua Multitasking Environment.
====================================

"A nice generic framework to develop complex, portable concurrent applications 
in Lua." 


Extremely simple environment for coroutine based multitasking. Consists of a 
scheduler, and that's it.
Created after finding a presentation by Fabien Fleutot for the 2011 Lua 
Workshop ( see http://lua-users.org/lists/lua-l/2011-10/msg01057.html )

* Tasks can emit signals, and block waiting for them, and that's it.
	* Can wait on several signals, with a timeout.
* A single Lua file, no C, no external dependencies. 
	* can have use for a clock (os.time() will do)
	* can have use for a idle function (busy waiting or socket.sleep will
	  do)
* Can interface with LuaSocket and nixio for socket and async i/o support.
* Only most basic of optimizations done.
* Works with Lua 5.1, 5.2 and LuaJIT.

====================================

Sample programs:

local sched = require "sched"
sched.run(function() 
	local A=sched.run(function() 
		sched.catalog.register('A')
		sched.sleep(2)
		sched.signal('ev', 'data!')
	end)
	local B=sched.run(function() 
		local A = sched.catalog.waitfor('A')
		local _, status = sched.wait({emitter=A,events={'die'}})
		error('xxx')
	end)
	local _, x = sched.wait({emitter=A, events={'ev'}})
	sched.kill(A)
	return x
end)
sched.go()



Available at https://github.com/xopxe/Lumen