[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
[LI] Signal behaves differently on LINUX and HPUX
Hi,
SIGALRM interrupts the system calls in HPUX even when
signal handler is present.
When the signal is sent, the signal handler is called but the blocking
system calls like "accept" are interrupted.
Can somebody tell why does this happen on HPUX and
how to solve it?
regards
-------
PS: Following is the code when run on HPUX "scanf" is interrupted. On
Linux "scanf" will wait till user presses any key.
{ Looks like commercial unices can't match Linux ;-) }
-------
#include <stdio.h>
#include <signal.h>
void signal_handler(int i)
{
printf("received sig alarm\n");
signal(SIGALRM,signal_handler);
alarm(10);
return;
}
void main(void)
{
int value;
alarm(5);
signal(SIGALRM,signal_handler);
printf("Enter the value : \n");
scanf("%d",&value);
printf("The read value is %d\n",value);
}
---------
--------------------------------------------------------------------
The Linux India Mailing List Archives are now available. Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.