lua-users home
lua-l archive


In 5.0, is calling lua_closethread for a Lua thread with a non-empty
call stack fully supported (won't blow up, won't leak, etc)? I need to
do this (i.e. it's very ugly if I can't), and am currently doing so
(4.1w4) with no noticeable ill effects. But I want to make sure this
doesn't bite me in the butt down the road. Specifically, at the moment
lua_closethread is called, the Lua thread being closed is guaranteed to
be inside a registered C Lua function (I can explain if it matters). And
lastly, after the call to lua_closethread, the OS "thread" (Win32 fiber
really) executing the Lua thread is terminated, hence the registered
function never returns and the Lua call stack executing that Lua thread
never unwinds (although the stack space is reclaimed).

If the answer is that it's not guaranteed to be supported, suggestions
for dealing with that are welcome.