lua-users home
lua-l archive

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


On Jul 18, 2011, at 11:50 AM, James McKaskill wrote:

>> This is a great reason to use LUA_RIDX_MAINTHREAD for callbacks in Lua 5.2
> 
> That only gets you half way there. The main thread won't be gc'ed but
> it may not be ready (yielded or resumed another coroutine). The only
> method that is guaranteed to work is to create a thread for each
> callback, but that seems a bit exuberant. I'm not sure how much
> overhead this will entail without some testing. If its too much a
> thread pool might be the way to go.

The thread used by the callback does not need to be "ready" as long as the callback is well behaved (which seems necessary in any case). See:

http://lua-users.org/lists/lua-l/2010-02/msg00447.html

and the follow-up.

e