Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site sdcsvax.UUCP Path: utzoo!watmath!clyde!floyd!harpo!decvax!ittvax!dcdwest!sdcsvax!mr-frog From: mr-frog@sdcsvax.UUCP Newsgroups: net.unix-wizards Subject: bug with setitimer on 4.2 BSD? Message-ID: <634@sdcsvax.UUCP> Date: Fri, 30-Mar-84 10:05:06 EST Article-I.D.: sdcsvax.634 Posted: Fri Mar 30 10:05:06 1984 Date-Received: Sun, 1-Apr-84 08:19:02 EST Organization: EECS Dept., U.C. San Diego Lines: 46 : I've been experimenting recently with the system call setitimer, and I was quite distressed to find that after several successive calls (around 300 or so) it stopped working! What the call is supposed to do is to send the process an alarm (SIGALRM) when an appropriate number of microseconds have passed. It worked just fine for a while, but at some (seemingly random) point it simply doesn't send that SIGALRM, and the program waiting for it hangs. Am I using setitimer properly? Here is the code I ran to test and duplicate the problem: /*************************************************************************/ #include #include #include struct itimerval timer; int wakeup; main() { int alarmtrap(); register int i; signal(SIGALRM, alarmtrap); timer.it_interval.tv_sec = 0; timer.it_interval.tv_usec = 0; timer.it_value.tv_sec = 0; wakeup = 0; for (i=0; i<1000; i++) { timer.it_value.tv_usec = 30000; setitimer(ITIMER_REAL, &timer, NULL); sigpause(0); printf("alarm %d\n", wakeup); } } alarmtrap() { wakeup++; } /*******************************************************************/ Dave Pare ucbvax!sdcsvax!mr-frog