0

hi programmers!)
Please help me understand this -
as I understand from practice - the getting SIGALRM by process is ends the process - but I can't find the explanation of this guess.
for exp. -
I have code -

int main(void)
{
/* Установить будильник */
sleep(1);
if((alarm(5)) > 0)
printf("an alarm was already set"); else puts("know we've set the alarm - there wasn't any before.");

sleep(30);
puts("how did we get here?");
exit(EXIT_FAILURE);
}

we'll never see the message

how did we get here?

but whY?
thanks in advance)

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by vedro-compota
1

Each signal has an associated default handler (or action). In the case of SIGALRM that action is to terminate the process. You can change this default action (for most signals) by registering a signal handler of your own or assigning SIG_IGN (ignore).

Votes + Comments
+++++++++
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.