Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Date: Mon, 26 Jun 2000 16:24:42 -0400 (EDT) From: "Ashif S. Harji" To: cygwin AT sourceware DOT cygnus DOT com Subject: setitimer with values less than 1000 microseconds Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII When I use setitimer with a value less than 1000 microseconds, no sigalrms are generated. Consider the following program: #include #include int alarm( int sig ) { } int main() { itimerval it; it.it_interval.tv_sec = 0; it.it_interval.tv_usec = 0; it.it_value = (timeval){ 0, // seconds 10 }; // microseconds signal( SIGALRM, (void (*)(int))alarm ); setitimer( ITIMER_REAL, &it, (itimerval *)0 ); // set the alarm clock to go off sigpause( 0 ); } // It simply hangs unless I use a timer value of 1000 microseconds or higher. When I run this program on a linux or sun sparc machine, it works fine. The difference seems to be that on these machines the timer value is rounded up to the nearest resolution value. However, with cygwin the values are rounded down. That is in the source code for setitimer in window.cc: elapse = itv.it_value.tv_sec * 1000 + itv.it_value.tv_usec / 1000; if (elapse == 0) return 0; if (!(timer_active = SetTimer (gethwnd(), 1, elapse, NULL))) { __seterrno (); return -1; } elapse evaluates to 0 for values less than 1000 microseconds. Thus, for small time values, the timer is simply killed. Is it possible to changes this so that small time values are rounded up to the smallest resolution? thanks, ashif harji -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com