home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / abort.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  1KB  |  56 lines

  1. /***
  2. *abort.c - abort a program by raising SIGABRT
  3. *
  4. *       Copyright (c) 1989-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines abort() - print a message and raise SIGABRT.
  8. *
  9. *******************************************************************************/
  10.  
  11. #include <cruntime.h>
  12. #include <stdlib.h>
  13. #include <internal.h>
  14. #include <rterr.h>
  15. #include <signal.h>
  16.  
  17. /***
  18. *void abort() - abort the current program by raising SIGABRT
  19. *
  20. *Purpose:
  21. *       print out an abort message and raise the SIGABRT signal.  If the user
  22. *       hasn't defined an abort handler routine, terminate the program
  23. *       with exit status of 3 without cleaning up.
  24. *
  25. *       Multi-thread version does not raise SIGABRT -- this isn't supported
  26. *       under multi-thread.
  27. *
  28. *Entry:
  29. *       None.
  30. *
  31. *Exit:
  32. *       Does not return.
  33. *
  34. *Uses:
  35. *
  36. *Exceptions:
  37. *
  38. *******************************************************************************/
  39.  
  40. void __cdecl abort (
  41.         void
  42.         )
  43. {
  44.         _NMSG_WRITE(_RT_ABORT); /* write the abort message */
  45.  
  46.  
  47.  
  48.         raise(SIGABRT);     /* raise abort signal */
  49.  
  50.         /* We usually won't get here, but it's possible that
  51.            SIGABRT was ignored.  So hose the program anyway. */
  52.  
  53.  
  54.         _exit(3);
  55. }
  56.