EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Functions
epicsExit.h File Reference

Extended replacement for the Posix exit and atexit routines. More...

#include <libComAPI.h>
Include dependency graph for epicsExit.h:

Go to the source code of this file.

Macros

#define epicsAtExit(F, A)   epicsAtExit3(F,A,#F)
 Convenience macro to register a function and context value to be run when the process exits. More...
 

Typedefs

typedef void(* epicsExitFunc )(void *arg)
 Pointer to a callback function that is to be called by the epicsExit subsystem.
 

Functions

LIBCOM_API void epicsExit (int status)
 Calls epicsExitCallAtExits(), then the OS exit() routine. More...
 
LIBCOM_API void epicsExitLater (int status)
 Arrange to call epicsExit() later from a low priority thread. More...
 
LIBCOM_API void epicsExitCallAtExits (void)
 Internal routine that runs the registered exit routines. More...
 
LIBCOM_API int epicsAtExit3 (epicsExitFunc func, void *arg, const char *name)
 Register a function and an associated context parameter. More...
 
LIBCOM_API void epicsExitCallAtThreadExits (void)
 Internal routine that runs the registered thread exit routines. More...
 
LIBCOM_API int epicsAtThreadExit (epicsExitFunc func, void *arg)
 Register a function and an context value to be run by this thread when it returns from its entry routine. More...
 

Detailed Description

This is an extended replacement for the Posix exit and atexit routines, which also provides a pointer argument to pass to the exit handlers. This facility was created because of problems on vxWorks and windows with the implementation of atexit, i.e. neither of these systems implement exit and atexit according to the POSIX standard.

Definition in file epicsExit.h.

Macro Definition Documentation

#define epicsAtExit (   F,
 
)    epicsAtExit3(F,A,#F)
Parameters
FFunction to be called at process shutdown.
AContext parameter for the function.

Definition at line 71 of file epicsExit.h.

Function Documentation

LIBCOM_API void epicsExit ( int  status)
Parameters
statusPassed to exit()
LIBCOM_API void epicsExitLater ( int  status)

This delays the actual call to exit() so it doesn't run in this thread.

Parameters
statusPassed to exit()
LIBCOM_API void epicsExitCallAtExits ( void  )

Calls each of the functions registered by prior calls to epicsAtExit in reverse order of their registration.

Note
Most applications will not call this routine directly.
LIBCOM_API int epicsAtExit3 ( epicsExitFunc  func,
void *  arg,
const char *  name 
)
Parameters
funcFunction to be called when epicsExitCallAtExits is invoked.
argContext parameter for the function.
nameFunction name
LIBCOM_API void epicsExitCallAtThreadExits ( void  )

Calls each of the functions that were registered in the current thread by calling epicsAtThreadExit(), in reverse order of their registration.

Note
This routine is called automatically when an epicsThread's main entry routine returns. It will not be run if the thread gets stopped by some other method.
LIBCOM_API int epicsAtThreadExit ( epicsExitFunc  func,
void *  arg 
)
Parameters
funcFunction be called at thread completion.
argContext parameter for the function.