Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Contingency and STXIT routines

&pagelevel(2)&pagelevel

This chapter provides information on how contingency or STXIT routines can be implemented in C.

Familiarity with the concept of contingency and STXIT routines is important to the understanding of this chapter. These concepts as well as the corresponding BS2000 system macros are described in detail in the "Executive Macros" manual.

The library functions mentioned in this section (signal, raise, alarm, cenaco, cdisco, cstxit, _cstxit, longjmp, setjmp) are explained at length in chapter "Alphabetical reference" in this manual.

Caution

Using some of the C library functions from within STXIT routines may result in undefined behavior. Consistency in the library functions cannot always be guaranteed in the event of asynchronous interrupts.
Undefined behavior results if the same library function or a library function belonging to the same group (see list) which has been asynchronously interrupted by the STXIT event is to be executed within the STXIT routine.

The "critical" C library functions in connection with asynchronous interrupts are as follows:

  • memory management routines: malloc, calloc, realloc, free

  • file access functions for opening and closing files: 
    fopen/fopen64, freopen/freopen64, open/open64, creat/creat64, fclose,close

  • all file access, file management and input/output functions used on the same file

  • random number generator functions: rand, srand

  • time functions: localtime/localtime_r, gmtime/gmtime_r

  • functions for enabling and disabling contingency routines: cenaco, cdisco

  • atexit

  • strtok

  • setlocale

The "critical" functions also include the input/output functions in the C++ standard library.