lua-users home
lua-l archive

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


It was thus said that the Great Dirk Laurie once stated:
> The code for lua.c includes signal.h and contains several references
> to signal(). Since I know nothing about this, I have consulted the
> manpage for signal(). It starts thus:
> 
>       The behavior of signal() varies across UNIX versions, and has also var‐
>        ied historically across different versions of Linux.   Avoid  its  use:
>        use sigaction(2) instead.  See Portability below.
> 
> Is there a good reason, maybe something to do with other systems, why
> the Lua source uses signal() rather than sigaction()?

  As Roberto said, signal() is ANSI C (or ISO C, take your pick) while
sigaction() is POSIX.

  But I implore you, abandon your attempts to use signals for you will be in
a world of pain and misery [1].  Issues can be hard to debug [2] and there
could be unintended consequences when writing signal handlers [3].

  -spc (Personally, I try to keep as far away from them as possible)

[1]	http://boston.conman.org/2015/04/30.1

[2]	http://boston.conman.org/2007/10/18.1

[3]	http://boston.conman.org/2007/10/22.2