Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE37BEEB9@probe-2.acclaim-euro.net> From: Shawn Hargreaves To: djgpp AT delorie DOT com Subject: Re: "Locking" code Date: Wed, 17 Mar 1999 14:31:19 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1460.8) Content-Type: text/plain Reply-To: djgpp AT delorie DOT com Jonathan Villani writes: > My question: if I lock the read_chunk function, is this code safe? > Does it locks automatically the "fread" in the read_chunk function? That's really not a good thing to do. It isn't just paging that can be a problem: any call to DOS functions from inside an interrupt handler is very bad news because DOS is totally non reentrant. This is a good way to wipe large chunks of your hard drive! Even leaving the DOS problems aside, libc itself is largely not reentrant, and none of it will be locked unless you've set the CRT0 flags to lock your entire program into physical memory (not a very polite thing to do). So I'm afraid you really need to find some way other than calling these functions from a hardware interrupt handler. Running large chunks of code in an interrupt context leads to all sorts of nasty probems, and is almost always a bad idea. Shawn Hargreaves.