www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/05/15:04:17

Date: Fri, 5 May 2000 14:18:03 -0400 (EDT)
Message-Id: <200005051818.OAA05711@indy.delorie.com>
From: Eli Zaretskii <eliz AT delorie DOT com>
To: Frederic Cazenave <cazenave AT radar DOT mcgill DOT ca>
CC: djgpp AT delorie DOT com
In-reply-to: <3911DCB6.3AC3477E@radar.mcgill.ca> (message from Frederic
Cazenave on Thu, 04 May 2000 20:23:48 GMT)
Subject: Re: Signal & setitimer
References: <3911DCB6 DOT 3AC3477E AT radar DOT mcgill DOT ca>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Frederic Cazenave <cazenave AT radar DOT mcgill DOT ca>
> Date: Thu, 04 May 2000 20:23:48 GMT
> 
> I have written a small progranm to test setitmer.
> It's appear this code run correctly on a unix system but
> not under DOS.
> Under UNIX the timer is reactivate every 10 seconds, but
> under dos the timer is active the first time but after is never
> reactivate.

I cannot reproduce this with your test program on my machine.  On what
OS did you try this, and what version of DJGPP do you use?

I do see a small bug in the current version of setitimer, however.
The source patch is below; if you are using DJGPP v2.03, perhaps it
will solve your problem as well.

*** src/libc/posix/signal/itimer.c~0	Sun Nov 28 06:26:56 1999
--- src/libc/posix/signal/itimer.c	Fri May  5 19:01:24 2000
*************** setitimer(int which, struct itimerval *v
*** 248,254 ****
    if (usecs_min < 0)
      usecs_min = DEFAULT_CLOCK_TICK_INTERVAL;
    usecs = value->it_interval.tv_usec;
!   if (value->it_interval.tv_sec == 0 && usecs < usecs_min)
      usecs = usecs_min;
  
    /* This doesn't overflow and doesn't cause any rounding errors,
--- 248,254 ----
    if (usecs_min < 0)
      usecs_min = DEFAULT_CLOCK_TICK_INTERVAL;
    usecs = value->it_interval.tv_usec;
!   if (value->it_interval.tv_sec == 0 && usecs && usecs < usecs_min)
      usecs = usecs_min;
  
    /* This doesn't overflow and doesn't cause any rounding errors,

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019