delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/07/22/11:39:06

Message-Id: <199707221533.LAA29265@delorie.com>
From: Oberhumer Markus <k3040e4 AT c210 DOT edvz DOT uni-linz DOT ac DOT at>
Subject: Exception problem with __dpmi_yield()
To: djgpp-workers AT delorie DOT com (djgpp-workers)
Date: Tue, 22 Jul 1997 17:28:52 +0200 (METDST)
Return-Read-To: markus DOT oberhumer AT jk DOT uni-linz DOT ac DOT at
Mime-Version: 1.0

/*
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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019