Skip to content
Snippets Groups Projects
user avatar
Nadav Har'El authored
This patch adds support for Linux's alarm(2) system call.

alarm() is needed in some ancient Unix software, like netperf :(

This implementation is fully compatible with Linux's alarm(), but please
note that what alarm() does when the alarm times out is a kill(SIGALRM) -
so all the caveats mentioned in the previous patch regarding kill(),
will also apply here.

Alarm() is implemented by running one "alarm thread", started on the
first alarm() call. This alarm-thread waits for the alarm to expire,
or for instructions to change the alarm. When an alarm expires the
alarm thread does a kill(0,SIGALRM).

tst-kill.cc (from the previous patch) includes a test to see that
alarm() really sends a SIGALRM signal on time, and also that we can
cancel a pending alarm and not receive a signal.

Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
ee88c900
History
Name Last commit Last update