[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua and signal trapping
- From: Klaus Ripke <paul-lua@...>
- Date: Tue, 19 Jul 2005 22:36:22 +0200
On Tue, Jul 19, 2005 at 02:38:18PM -0400, Mark McDonald wrote:
> In my initial investigation of Lua, I am struck by it's elegance,
> but I have not seen any capability to trap unix signals (i.e. sighup,
> sigint).
> If I have missed this, please correct me.
clearly there is no "standard" capability, since the behaviour
of signals is highly varying -- there are even systems without
signals at all, and even on rather "standard" conforming *nixens
special environments like e.g. the old LinuxThreads can change
these things in weird ways.
However, this is not bad news, but good news:
Since Lua does not care, you can set whichever signal handler
you want without fearing any interference with anything.
Anyway, whether multithreaded or not, you must not try to
access any lua_State from within a signal handler.
Thus running some lua code on a signal requires the signal handler
to forward the event to some synchronous event handling loop
like that of http://www.keplerproject.org/copas/
But if your project is based on some library having it's own
ideas of signal handling a/o it's own event loop,
you can follow that way.
salud