www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/07/28/08:57:25

From: kunst AT prl DOT philips DOT nl
Subject: Atexit() routines called after abort()
To: djgpp AT sun DOT soe DOT clarkson DOT edu (DJGPP users list)
Date: Wed, 28 Jul 1993 14:49:24 +0100 (METDST)

Hello DJ,

I have a UNIX program which issues a call to 'abort()' inside 
a routine which is part of the 'atexit()' list, as a final means
of terminating the program bluntly (yes, very crude...).

This works on my UNIX system (i.e. I get a core dump), but the DJGPP 
'abort()' doesn't prevent the 'atexit()' routines from execution.
This results in a hanging program printing "Abort!" a zillion times.

Perhaps you could set a flag inside the 'abort()' routine which
prevents the 'atexit()' routines from being executed (in a next release).

Kind regards, Pieter Kunst.

----------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>

void onexit (void)
{
  printf ("Inside onexit...");
}

main()
{
  atexit (onexit);
  printf ("Before abort...\n");
  abort ();
  printf ("After abort...\n");
}
----------------------------------------------------------------------
UNIX output:

Before abort...
IOT trap (core dumped)
----------------------------------------------------------------------
DJGPP output:

Before abort...
Abort!
 Inside onexit...
----------------------------------------------------------------------


 .^^^^^^^^           _____________________________________
 |      |          / Pieter Kunst (P.J.)                   \
 |  _  _|        /   Philips Research Laboratories,          \
.--(o)(o)      /     Building WY3, Prof. Holstlaan 4,         \
|@      _)   /       5656 AA  Eindhoven, The Netherlands.      |
  | ,___|   /        e-mail: kunst AT prl DOT philips DOT nl             /
  |   /     \_______________________________________________/
  /____\

- Raw text -


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