system hangs

Hod Greeley hod at star2.cm.utexas.edu
Fri Jul 6 06:50:40 AEST 1990


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 at star2.cm.utexas.edu



More information about the Comp.unix.wizards mailing list