Mail Archives: djgpp/1999/03/17/09:32:07
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.
- Raw text -