Mail Archives: djgpp/1996/12/04/23:38:01
From: | u7711501 AT bicmos DOT ee DOT nctu DOT edu DOT tw (Jih-Shin Ho)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | setitimer() under win3.1 and win95
|
Date: | 5 Dec 1996 00:54:50 GMT
|
Organization: | Computer Center, National Chiao-Tung University, Taiwan
|
Lines: | 37
|
Message-ID: | <5856gq$gm1@ccnews.nctu.edu.tw>
|
NNTP-Posting-Host: | bicmos.ee.nctu.edu.tw
|
NNTP-Posting-User: | u7711501
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi:
Can I use setitimer() under win3.1 and win95 ? I always get protection
fault. Note that this fault is reported by windows, not by Djgpp. That is,
the Djgpp run-time shows no problem, but windows sayes that this program is
bad. The following is the small source code I write:
#include <sys/time.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
static int value;
static void test(int signum)
{
value = 0;
}
volatile int i; /* force reading memory */
int main()
{
struct itimerval a;
a.it_interval.tv_sec = a.it_value.tv_sec = 0;
a.it_interval.tv_usec = a.it_value.tv_usec = 56000;
/* about 9 signals / second */
signal(SIGALRM,test);
setitimer(ITIMER_REAL,&a,NULL);
for (i = 0; i < 100; ++i) sleep(1);
return(0);
}
--
Jih-Shin Ho, National Chiao Tung University
u7711501 AT bicmos DOT ee DOT nctu DOT edu DOT tw
- Raw text -