lua-users home
lua-l archive

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


On Wed, 25 Mar 2009, John Dunn wrote:

> After looking more into my desire for asynchronous network
> communications, it appears as though a better solution might be to
> figure out a way to allow the users to spawn threads and use lua sockets
> directly.

IMHO this path is fraught with dangers.  Not only are you bringing all 
the normal badness of normal threading into the mix, the fact that all 
external C code is run without the Lua VM lock held makes calling out 
to external C modules a bit risky.  Most haven't been written to be 
threadsafe in the context of a threaded Lua VM.  Something like Lua 
Lanes with its default of shared-nothing is IMHO much safer.

If you nevertheless want to go down the shared global state path I 
suggest trying out LuaThread from

I've rolled the latest version of that into a single patch for Lua 
5.1.4 available at