Message-Id: <199807170802.AA24463@gcef.gc.maricopa.edu> Date: Fri, 17 Jul 1998 01:02:06 -0700 (MST) From: "Joshua James Turpen" <44699 AT ef DOT gc DOT maricopa DOT edu> To: djgpp AT delorie DOT com Subject: Re: longjmp() out of an interrupt handler Precedence: bulk > Josh Turpen, the author of the LWP multi-threading library, has suggested > using an illegal instruction trap to recover. This sounds like a promising > idea. Even better would be to use the threading library and just run the > call in a separate thread. I'll be looking into this... I'm not sure if it > will work with PMODE/DJ. Actually, I'm pretty sure it won't work, since the ___djgpp_hw_exception trick only works in protected mode. ___djgpp_hw_exception sets the segment limits on your pmode data selectors to NULL so that any access to them generates an exception which you can then transfer control away from. But in your case, it won't happen since the interrupt handler will return to the hung BIOS call, which isn't going to trigger the exception. So for example if you create a thread that calls system("command.com"), all threads are hung until command.com returns (because it runs in real mode). You could just have a blacklist of known bad BIOS's in your code. That's the easiest/safest way! If you really have to longjmp() out of a timer tick handler to escape from a hung bios under DPMI, there is a way, but it's technical, ugly, non-portable, DPMI implimentation specific, not recommended, etc. If you really can't find a better way I can send you the code that can longjmp() out of a dpmi interrupt handler. It's basically a failed attempt at a real-time version of LWP. Josh Turpen 44699 AT ef DOT gc DOT maricopa DOT edu