setitimer was used here to produce a periodic SIGALRM event faster than 1 sec.
I replaced the setitimer call with a beginthread which runs in an endless
loop (if this periodic timer is to be stopped in some other application,
you have to end such a thread somehow, of course):
void itimerthread(void* dummy) {
while(1) {
_sleep2(numer_of_milliseconds);
/* call SIGALRM handler */
itimerflag = 1; /* see below */
}
}
This thread _sleep2's for the specified interval time and would then call
the signal function which is called by a SIGALRM signal. In this example,
this is a no-op, because the side effect of SIGALRM is used here. Somewhere
in the code is a pause() call, which waits until a signal happens. I
replaced this pause() with a wait for a variable (an OS/2 semaphore would be
cleaner, but this here is not critical):
while (itimerflag==0) DosSleep(0); /* could be DosSleep(1) as well? */
itimerflag = 0;
and added a itimerflag=1 (see above) after the _sleep2 in the itimer thread.
This will animate the neko cat.
Such a mechanism might be worthwhile in many ports, maybe some of you can use
it.
--
Dr.-Ing. Holger Veit | INTERNET: Holger.Veit"at"gmd.de
| | / GMD - German National Research | Phone: (+49) 2241 14 2448
|__| / Center for Information Technology| Fax: (+49) 2241 14 2242
| | / Schloss Birlinghoven | Get XFree86/OS2 Bugfix Version
| |/ D-53754 Sankt Augustin, Germany | V3.3.1 from ftp.xfree86.org
WWW: http://borneo.gmd.de/~veit/ | /pub/XFree86/3.3.1/binaries/OS2