Two suggestions:

* Install the signal handler with `sigaction({ .sa_flags = SA_RESETHAND })`
* Use raise() to re-raise the signal, not kill().  raise() guarantees that the signal gets delivered to the same thread, kill() does not.