lua-users home
lua-l archive

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


DarkSideSync is a helper library to create Lua bindings for multithreaded libraries.

It is useful for a very specific usecase; libraries that need to be 'started' and then run their own threads/threadpools in the background on which they perform callbacks to the receiving end (Lua in this case). Examples of these are pupnp [1] and OpenZwave [2] for example.

Documentation is on github [3] (including an overview and some diagrams [4]) as is the source code [5].

So far I tested it successfully on Windows7, Ubuntu 10 and Raspberry Pi.

Features:
- It is very generic and cross platform. Because DSS
  takes care of threads, locks and (optionally) sockets,
  a library binding for an async library may require no 
  platform specific code and still work cross-platform
- It is setup as a separate library, loaded from Lua, no
  C links. It, sort of, dynamically extends the Lua C api
- Supports async callbacks that only deliver data (the 
  callback thread is not blocked)
- Supports async callbacks that need a response (the 
  callback thread is blocked until the Lua side response 
  has been delivered)
- Supports multiple async background libraries 
  simultaneously
- Supports multiple concurrent Lua states
- It has been setup with the intend to support multiple 
  versions of the DSS API, so in the future multiple 
  background libraries can use a single DSS library, while 
  talking to different versions of the API
- optional UDP notifications. The notification is also 
  platform independent and even network library independent 
  (eg. not bound to LuaSocket) any network library 
  supporting UDP will do (this is the reason for not using 
  file descriptors or pipes)


[1] http://pupnp.sourceforge.net/
[2] https://code.google.com/p/open-zwave/
[3] http://tieske.github.io/DarkSideSync/
[4] http://tieske.github.com/DarkSideSync/background_worker_lib_spec_0v4.pdf 
[5] https://github.com/Tieske/DarkSideSync

Comments are welcome.
Regards
Thijs

PS. Rockspec has just been submitted, so after it lands on the rocks server it can be installed using LuaRocks