Mail Archives: djgpp-workers/1997/07/22/11:39:06
/*
Subject: Exception problem with __dpmi_yield()
When I interrupt the following program with Control-C in my
Win95 DOS shell, I will get a protection error and my shell
painfully dies (try a few times).
You can avoid the crash by setting `__djgpp_hwint_flags |= 3;'.
Looks like a subtle bug in the exception handler to me.
Markus
*/
#include <signal.h>
#include <unistd.h>
#include <pc.h>
#include <dpmi.h>
#include <sys/exceptn.h>
int main()
{
void (*sig)(int);
sig = signal(SIGINT,SIG_IGN);
while (!kbhit())
{
#if 1
__dpmi_yield(); /* crashes */
#elif 1
usleep(1000*1000); /* crashes */
#else
((void)0); /* this won't crash */
#endif
}
signal(SIGINT,sig);
return 0;
}
- Raw text -