lua-users home
lua-l archive

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


I think there will be a lot of problems with this, and it will not work reliably. If you want to handle signals on Linux (non portably) then the signalfd interface works fine.



On Wed, Dec 26, 2012 at 4:02 PM, Owen Shepherd <owen.shepherd@e43.eu> wrote:

Lua signal handlers is not something I would ever expect to work in a reliable manner. Lua is not async signal safe.

That sounds like a terrible idea by luaposix

On 26 Dec 2012 15:59, "Bernd Eggink" <monoped@sudrala.de> wrote:
Hi,

I wonder if signal handling (as in luaposix) is supposed to work in any situation. Or are there limitations, preconditions etc.(on Linux)?

I'm asking because I have a program where signal() simply doesn't work. After putting

        local P = require "posix"
        P.signal(P.SIGUSR1, function() print("signal") end)

at the beginning of the program, I expect the command "kill -s USR1 $pid" to print "signal", but instead the program exits immediately. This even happens when the signal handling function is completely empty.

The program in question is pretty complex. However, in simple test programs signal() works as expected.

Any ideas what could prevent signal() from working correctly?

Greetings,
Bernd