Reentrant functions can be suspended at any point and restarted; they resume processing with no adverse effects. If a function uses no data that can be accessed by more than one thread, the function is said to be reentrant. In particular, a reentrant function cannot use data on the heap or in static memory. It can use only automatic (stack) and thread-local data. Because the function uses no data that can be modified by other threads, no additional care needs to be taken to serialize access to data or resources.
Note: it is possible to break a reentrant function by passing a pointer to shared data as a parameter to the function. To prevent this from happening, ensure that pointer parameters to library functions point to data whose access is properly serialized.
All functions in the C++ Complex Mathematics Library are reentrant. The I/O Stream Library functions are not.
![]()
Summary of Reentrant Functions
Critical (non-reentrant)
Functions