lua-users home
lua-l archive

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


Yes, your argument is valid
In our case it works as the coroutines run only for a short period before they return control to main thread.


Oliver

Am 03.03.21 um 10:22 schrieb Viacheslav Usov:
On Tue, Mar 2, 2021 at 8:12 PM Oliver Kroth <oliver.kroth@nec-i.de> wrote:

     lua_State *mainthread = G(L)->mainthread;
     lua_sethook( mainthread, fullstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1 );
Does this really work? Hooks are per-coroutine, so if a coroutine
happens to be running when the above executes, I believe it won't have
any effect till the main thread resumes, which may never happen.

When solving this problem (in a proprietary project, so, sorry, no
code) we ended up having to track coroutines and hook all of them.

Note to the original poster: this still does not solve the lua_pcall()
problem. So this is more of a suggestion that the Lua state should
terminate rather than a sure fire termination (for other reasons,
too).

Cheers,
V.