Hi
I want to catch a signal and continue the program. But when I catch it, my signal handler takes the control and program terminates after the signal handler returns.
Here is the code
Code:
struct itimerval it;
static void sig_handler(int sig)
{
printf("Signal\n");
}
int main()
{
signal(SIGALRM,sig_handler);
it.it_value.tv_sec=1;
it.it_value.tv_usec=0;
setitimer(ITIMER_REAL,&it,0);
sleep(10);
return 0;
}
I want to print screen "Signal" continuously when a signal is caugth (so, print "Signal" once in a second).
How can I do this?
Thanks...