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

Routines for code that can't continue or return after an error. More...

#include <stdlib.h>
#include "compilerDependencies.h"
#include "libComAPI.h"
Include dependency graph for cantProceed.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

LIBCOM_API void cantProceed (const char *errorMessage,...) EPICS_PRINTF_STYLE(1
 Suspend this thread, the caller cannot continue or return. More...
 
Memory Allocation Functions

These versions of calloc() and malloc() never fail, they suspend the thread if the OS is unable to allocate the requested memory at the current time. If the thread is resumed, they will re-try the memory allocation, and will only return after it succeeds. These routines should only be used while an IOC is starting up; code that runs after iocInit() should fail gracefully when memory runs out.

LIBCOM_API void * callocMustSucceed (size_t count, size_t size, const char *errorMessage)
 A calloc() that never returns NULL. More...
 
LIBCOM_API void * mallocMustSucceed (size_t size, const char *errorMessage)
 A malloc() that never returns NULL. More...
 

Detailed Description

This is the EPICS equivalent of a Kernel Panic, except that the effect is to halt only the thread that detects the error.

Definition in file cantProceed.h.

Function Documentation

LIBCOM_API void cantProceed ( const char *  errorMessage,
  ... 
)

The effect of calling this is to print the error message followed by the name of the thread that is being suspended. A stack trace will also be shown if supported by the OS, and the thread is suspended inside an infinite loop.

Parameters
errorMessageA printf-style error message describing the error.
...Any parameters required for the error message.
LIBCOM_API void* callocMustSucceed ( size_t  count,
size_t  size,
const char *  errorMessage 
)
Parameters
countNumber of objects.
sizeSize of each object.
errorMessageWhat this memory is needed for.
Returns
Pointer to zeroed allocated memory.
LIBCOM_API void* mallocMustSucceed ( size_t  size,
const char *  errorMessage 
)
Parameters
sizeSize of block to allocate.
errorMessageWhat this memory is needed for.
Returns
Pointer to allocated memory.