hod@star2.cm.utexas.edu (Hod Greeley) (07/06/90)
We have a problem running the following code on our system, a stellar
GS2000 running unix system V with BSD extensions. The code prints the
message and exits, seemingly properly, but then the system hangs. Am
I doing something stupid? Even if I am, should it have this drastic
an effect?
Here's the code:
#include <stdio.h>
#include <signal.h>
#include <sys/time.h>
#define UPDATE 200000
SetTimer()
{
struct itimerval udt;
udt.it_interval.tv_sec = 0L;
udt.it_interval.tv_usec = UPDATE;
udt.it_value.tv_sec = 0L;
udt.it_value.tv_usec = UPDATE;
setitimer(ITIMER_REAL, &udt, 0);
}
main()
{
void msg();
signal(SIGALRM, msg);
SetTimer();
for (;;) {}
}
void msg()
{
puts("signal alarm received.");
exit();
}
color me confused.
Hod Greeley
hod@star2.cm.utexas.edu