Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!ogicse!pturner From: pturner@ese.ese.ogi.edu (Paul Turner) Newsgroups: comp.unix.aix Subject: Need help with SIGALRM/ualarm Keywords: SIGALRM, signals, alarm, ualarm Message-ID: <13211@ogicse.ogi.edu> Date: 23 Oct 90 16:53:59 GMT Sender: news@ogicse.ogi.edu Distribution: usa Organization: Oregon Graduate Institute - Department of Env. Science and Eng. Lines: 74 Hello, I'm trying to do some animation on an RS6000 (a 320 w AIX 3.1 plus the 3001 update) and I'm having problems with the alarm call. The following code fragment performs exactly as I expected on a Sun w SunOS 4.0 but fails on the RS6000 with a single call to the alarm signal handler followed by the termination of the program. like: % testalarm r <- initialize the alarm handler Called <- from the handler Alarm call <- from AIX !!?? and the program terminates What I believe to be the correct behavior is a continuous stream of 'Called' lines - as set below, every 100 milliseconds. This is what happens on our Suns. Any clues? Is there a different way of doing this using some other method? I can't use X/Xt calls to XtAddTimeOut (which is what I'm trying to replace). Is it a bug or am I doing something wrong? Any help would be appreciated. Thanks, --Paul Paul J. Turner pturner@ese.ogi.edu ------------ cut here ---------- #include #include void animate() { printf("Called\n"); } /* * set a SIGALRM handler, the ualarm * call sets the first call after 1 sec and calls * are made every 100 milliseconds thereafter */ setrun() { signal(SIGALRM, animate); ualarm(1000000, 100000); } setstop() { signal(SIGALRM, SIG_IGN); } main() { char s[256]; while (1) { gets(s); switch (s[0]) { case 'q': exit(0); break; case 'r': setrun(); break; case 's': setstop(); break; } s[0] = 0; } }