[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: [LI] Signal behaves differently on LINUX and HPUX



This may be because , In linux scanf is implemented as atomic operation & in
HPUX, it may not have been implemented
as atomic operaration. Hope you understand what I mean by atomic ( If
execute one , then execute all)

Bye

> -----Original Message-----
> From:	Ghins Mathai [SMTP:ghins@xxxxxxxxxxxxxxx]
> Sent:	Thursday, October 14, 1999 11:24 AM
> To:	linux-india@xxxxxxxxxxxxxxxxxxxxx
> Subject:	[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.
--------------------------------------------------------------------
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.