delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/04/05/03:32:53

Date: Fri, 5 Apr 1996 10:26:23 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp-workers AT delorie DOT com
Subject: Ctrl-C under QDPMI
Message-Id: <Pine.SUN.3.91.960405101208.20066D-100000@is>
Mime-Version: 1.0

If you shell to DOS from a v2.0 program, then run another v2.0 program 
and terminate it with Ctrl-C, the parent app will be killed when you type 
``Exit'', even if it catches signals.  Ctrl-Break doesn't cause this.  
This seems to only happen under QDPMI; CWSDPMI and Win3.1 both work as 
advertised (people who have access to other DPMI hosts, like Win95, 
Dosemu, WinNT etc., can you please try this?).  A small program that I 
attach below can be used to test this.

Is there any workaround for this?  Maybe if the exception setup installed 
a handler for Int 23h, this won't happen?  Why don't we catch Int 23h, 
anyway?  When I try this test under CWSDPMI or Win3.1, the message from 
the default signal handler telling that ^C was pressed is printed twice: 
once only a part of it, then ^C, then the entire message again.  AFAIK, 
this is because DOS automatically restarts any interrupted function when 
^C is pressed.  But under QDPMI, I only see the first part of the 
message; the rest of it is printed MUCH later, when I type ``Exit'' and 
the parent program is killed (!).  That is why I think this is somehow 
connected to Int 23h.
------------------------- cut here ----------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

int main(void)
{
  __djgpp_exception_toggle ();
  fprintf (stderr, "call system()\n");
  setcbrk (0);
  system ("");
  fprintf (stderr, "back home\n");
  __djgpp_exception_toggle ();
  return 0;
}

- Raw text -


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