Need help with SIGALRM/ualarm
Paul Turner
pturner at ese.ese.ogi.edu
Wed Oct 24 02:53:59 AEST 1990
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 at ese.ogi.edu
------------ cut here ----------
#include <stdio.h>
#include <sys/signal.h>
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;
}
}
More information about the Comp.unix.aix
mailing list