lua-users home
lua-l archive

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


> 2. It calls lua_sethook from inside the signal handler. Where anybody gets
> the idea this is a clever thing to do, never mind the inkling that it might
> work when the documentation says nothing to that effect, I have no idea.

The standalone interpreter does this and it seems to work fine; lua_sethook
just sets a flag. Of course, it is true that standalone interpreter has
different requirements than a user application. In particular, the only
signal handling in the standalone interpreter is to handle interruptions.

My lalarm library uses the same technique for raising alarms and again it
seems to work just fine.

Note that in both cases the signal handler just sets a flag. The signal
itself is "handled" in Lua only when it is safe to do so, that is, outside
the actual C signal handler.