Using signals in redhat linux
Ishwar Rattan
ishwar@pali.cps.cmich.edu
Thu Aug 5 18:16:00 GMT 2004
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;
> }
>
More information about the Gcc-help
mailing list