devxlogo

Re-entrant Functions

Re-entrant Functions

A function that can be safely called while it’s already executing is said to be re-entrant. The C++ standard doesn’t state whether the Standard Library’s functions are re-entrant; this is an implementation-dependent feature. What’s the use of calling a function while it’s already executing? There are two occasions in which this scenario can happen: when the function is invoked by two or more distinct threads of the same program, or when executing a signal handler that raises the same signal once again. In either case, remember that calling a non re-entrant function while it’s already executing is a bad idea ? the program’s behavior is undefined in this case.

devx-admin

Share the Post: