UNIX signals not dispatched after fork()
In the attached test case, GSocketService
is created, then the program detaches from the terminal using fork and a SIGTERM handler is added using g_unix_signal_add
. But the handler never fires.
Steps to reproduce:
- run
signals-fork
pkill -SIGTERM "signals-fork"
Result: program runs further
Expected: program exits
If the g_unix_signal_add()
is called before fork()
, the issue appears even without the GSocketService
.
The solution is to fork asap, I guess, but still this is unexpected and the docs don't mention anything, if I'm not mistaken.