This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Using signals in redhat linux
- From: Ishwar Rattan <ishwar at pali dot cps dot cmich dot edu>
- To: Claudio Lavecchia <Claudio dot Lavecchia at eurecom dot fr>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 5 Aug 2004 13:34:46 -0400 (EDT)
- Subject: Re: Using signals in redhat linux
- References: <41126A76.60802@eurecom.fr>
Did your code work on any other system?
Learn nature of signals and related calls first!
-ishwar
On Thu, 5 Aug 2004, Claudio Lavecchia wrote:
> Hello people,
>
> I have a quick question about using signals in Linux environment -
> redhat 7.3.
> I'm using GCC version 2.96.
> I'm trying to launch and intercept signals - but the signals never get
> intercepted.
>
> Any of you guys have an idea of why? Do I have to set any compile option?
>
> I include the very simple test (using both alarm() and raise() to send
> signals)
>
> Thanks a lot
>
> Claudio
>
> #include <stdio.h>
> #include <signal.h>
> #include <time.h>
>
>
> void processAlarm()
> {
> signal(SIGALRM, processAlarm);
> printf("ALARM INTERCEPTED");
> alarm(3);
> }
>
> void processSIG()
> {
> signal(100, processSIG);
> printf("SIG INTERCEPTED");
> }
>
> int main(int argc, char *argv[])
> {
> printf("Launching Alarm Test\n");
> signal(SIGALRM, processAlarm);
>
> printf("Launching Alarm (previous alarm value: %d)\n",alarm(3));
> printf("Alarm value:%d\n",alarm(0));
>
> signal(100, processSIG);
> raise(100);
>
> while (1);
> return 0;
> }
>