This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Using signals in redhat linux
- From: Claudio Lavecchia <Claudio dot Lavecchia at eurecom dot fr>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 05 Aug 2004 19:12:22 +0200
- Subject: Using signals in redhat linux
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;
}