lua-users home
lua-l archive

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

The best answer appears to be to adopt what lua.c does for handling signals: Do a lua_sethook() with a low instruction count and in the hook throw an exception with luaL_error(), [1]. In my case, this code would be called by a distinct OS thread (not a signal handler), so I’m looking carefully at the thread-safety of lua_sethook().

Do you think about coroutines? The lua vm would be in a coroutine that is not the main thread. 

My solution is add some code to luaV_execute() to check a signal (A global variable) that trigger by a distinct OS thread.