From: James W Sager Iii Newsgroups: comp.os.msdos.djgpp Subject: Re: DJ: Compiler Optimizations Date: Sat, 21 Mar 1998 00:37:25 -0500 Organization: Junior, MCS Undeclared, Carnegie Mellon, Pittsburgh, PA Lines: 61 Message-ID: <8p4p8J600YUx1_I0w0@andrew.cmu.edu> NNTP-Posting-Host: po6.andrew.cmu.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk >... >Windows 95 reprograms the system timer in certain ways that are not 100% >compatible with what Allegro wants it to do. It seems that the faster >your computer is, the less problematic the timer is, but on slower >machines you can get error messages and potentially crashes. If a timer >problem is occurring, Shawn Hargreaves provides a couple of ways to deal >with it. >Windows 95 makes much heaver use of virtual memory than does DOS. In >fact, it may decide to swap some vital piece of your program's code or >data out of physical RAM while the program is running. If this code or >data is part of or is used by an interrupt handler, it won't be there >when the system looks for it; thus causing a hard crash. The solution >is to lock all code and data touched by interrupt handlers. Swapping >happens under DOS, too, but it's far more likely to occur in Win95. Here's a snipit of code that I believe correctly locks out the function? I'm fairly certain it works correctly, but I'd rather make sure. #include "whatever.h" //global flag type variable volatile int V_cursor_flip; //Interrupt function: void cursor_blink() { V_cursor_flip=1; } END_OF_FUNCTION(cursor_blink); void main(void) { //locking out the function V_cursor_flip=0; LOCK_VARIABLE(V_cursor_flip); LOCK_FUNCTION(cursor_blink); install_int_ex(cursor_blink, BPS_TO_TIMER(5)); while (true) { if(V_cursor_flip==1) { cout<<"The cursor flipped"<