Author :
Mike Sharov
Date :
2021-04-25 09:12:29
Hash :4f8a6144 Message :Retry write on EINTR in signal handler
The signal handler writes the received signal number as a byte value
into the notification pipe. If two signals are received in quick
succession, one of the writes may fail with EINTR without writing the
byte. This commit will check for EINTR and retry the write. If the error
is other than EINTR, a warning will be logged.
Note, that:
- on systems with sigaction libevent uses sigaction with SA_RESTART
- on linux writing to pipe is restartable and firstly it will try to
write that byte so linux should not be affected in any form [1].
[1]: https://elixir.bootlin.com/linux/latest/source/fs/pipe.c#L545