lua-users home
lua-l archive

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

Maybe this comes to myself not being so at ease with coroutine coding. Maybe the best way to do the server I've been involved with is using coroutines.

Or a combination of the two, so that each core of a multicore processor gets its share of the workload. That -at least- is something a coroutine approach by itself cannot do.


Phoenix Sol kirjoitti 6.9.2009 kello 18:17:

I was thinking about using coroutines however I'm afraid a fatal error in one coroutine will affect others that's why it's not option atm. Thanks for the links! I'm currently looking at LuaJIT and Rings. Rings seems to be a possible solution for my problem.

What can an error do inside a coroutine (a lua_State created with lua_newthread), that it could not do inside a lua_State created with lua_newstate?

lua_newthread gives you a garbage collected lua_State with all the globals of your original state. Is this not what you want?

Asko, why would a server want to call lua_newstate or luaL_newstate for each request, instead of lua_newthread?

Please tell me what I'm missing here.