Message-ID: <3911DCB6.3AC3477E@radar.mcgill.ca> From: Frederic Cazenave Organization: IRD (ex ORSTOM) X-Mailer: Mozilla 4.08 [en] (X11; I; IRIX64 6.1 IP26) MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Signal & setitimer Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 63 Date: Thu, 04 May 2000 20:23:48 GMT NNTP-Posting-Host: 132.206.246.96 X-Complaints-To: abuse AT mcgill DOT ca X-Trace: carnaval.risq.qc.ca 957471828 132.206.246.96 (Thu, 04 May 2000 16:23:48 EDT) NNTP-Posting-Date: Thu, 04 May 2000 16:23:48 EDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello, 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. Thanks for your help Fred #include #include #include #include void alarm() { printf("Alarm !\n"); signal (SIGALRM,alarm); } void main() { static struct itimerval timeout; int i; timeout.it_interval.tv_sec=0; timeout.it_interval.tv_usec = 0; timeout.it_value.tv_sec=5; timeout.it_value.tv_usec = 0; signal (SIGALRM,alarm); printf("Signal Test :\n"); i = 0; while (1) { sleep(1); if ( ++i == 10) { setitimer(ITIMER_REAL,&timeout,NULL); i=0; } printf("."); fflush(stdout); } } -- _________________________________________________________ | | | Frederic CAZENAVE | | _/\_ /^= McGill Radar | | \_/ \// Box 198, MacDonald College | | | /-\ | Ste Anne de Bellevue | | || || Quebec, Canada H9X 3V9 | | Tel (514) 398 7733 fax (514) 398 7755 | | mailto:Frederic DOT Cazenave AT hmg DOT inpg DOT fr | | http://www.mpl.orstom.fr/hydrologie/catch/ | |__________________________________________________________|