abort

Terminates an NLMâ„¢ application abnormally

Local Servers:blocking
Remote Servers:N/A
Classification:ANSI
Service:Thread

Syntax

  #include <assert.h> 
  #include <nwthread.h> 
  #include <stdlib.h>  
   
  void abort  (void); 
  

Return Values

None

Remarks

This function causes the NLM to be terminated abnormally. It writes the following termination message to the System Console Screen:

   ABNORMAL NLM TERMINATION in: NLMname 
  

The abort function then raises SIGABRT and calls _exit (3).

The following sequence of events occurs when the NLM is terminated abnormally:

  • All threads in the NLM are destroyed.
  • Cleanup routines are called for any libraries that have registered cleanup routines and that the NLM has called. (For more information, see Library Concepts (NDK: Program Management).)
  • All screens are closed.
  • All first-level files (opened with open, sopen, create), including UNIX STREAMS, and also including files opened as a result of second-level I/O (opened with fopen, fdopen, freopen), are closed; however, the buffers of these are not flushed.
  • All open directories are closed.
  • All service advertising (started by AdvertiseService) is terminated.
  • All memory allocated by the NLM is freed.
  • The NLM is unloaded.

See Also

exit, _exit, ExitThread, raise

Example

  #include <assert.h> 
  #include <nwthread.h> 
  #include <stdlib.h>  
  #include <nwconio.h>  
   
  main()  
  {  
     printf("this should print\r\n");  
     getch();  
     abort();  
     printf("this should not print\r\n");  
     getch();  
  }