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)

Recommended Answers

All 2 Replies

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).

commented: +++++++++ +3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.