This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using signals in redhat linux


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;
> }
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]