_exit

Terminates the NLM without executing atexit functions or flushing buffers

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

Syntax

  #include <nwthread.h>  
   
  void _exit  (  
     int   status); 
  

Parameters

status
(IN) Specifies the NLM’s return code (currently, the status is ignored.)

Return Values

None.

Remarks

The _exit function causes a normal termination consisting of the following sequence of events:

  • 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 second-level files (opened with fopen, fdopen, freopen) are closed; however, the buffers of these are not flushed. Any files created by tmpfile are deleted and purged.
  • All screens are closed.
  • All remote sessions are terminated.
  • All other resources allocated by the NLM are freed.
  • The NLM is unloaded.

See Also

abort, exit, ExitThread, RegisterLibrary (NDK: Program Management)

Example

  #include <nwthread.h>  
  #include <stdio.h>  
   
  int main (int argc, char **argv)  
  {  
     FILE *fp;  
     atexit (myFunction);         /* myFunction declared elsewhere */  
     fp = fopen (argv[1], "r");  
     if (fp == NULL)  
     {  
        fprintf (stderr, Unable to open ’%s’\n, argv[1]);  
        _exit (1);  
     }  
     fclose (fp);  
     exit (0);  
  }