Glossary Updates12 new terms added to the glossaries · October 2, 2026, 22:44 CEST
AI TechDocKnowledge

Glossary · Automation software engineering and architecture

Reentrant function

Also known as: Reentrant code

German: Wiedereintrittsfähige Funktion

In programming, a reentrant function is a function that can be interrupted during execution and safely called again, for example by an interrupt or another task, before the first call has finished, because it keeps no unprotected shared or static state.

  • Software engineering

In one sentence

A reentrant function can be safely called again while a previous call is still running, because it keeps no unprotected shared state.

Example

The CRC calculation used by both the fieldbus interrupt and the logging task works only on its parameters and local variables, so it is reentrant.

How it applies

  • Engineering: Functions called from interrupts or several tasks must be reentrant: they use only local variables and parameters, or protect shared state. Many standard library functions are not reentrant.
  • PLC software: Functions in IEC 61131-3 have no persistent internal state, while function block instances do. Using the same instance from two tasks is a common source of errors.
  • Documentation: Library reference documentation should state for each function whether it is reentrant and whether it may be called from interrupts or several tasks.

Reentrant vs. thread-safe

A reentrant function can be re-entered even on the same thread, for example by an interrupt. A thread-safe function can be called from several threads at once, possibly by using locks, which may make it non-reentrant.

By knowledge.aitechdoc.world · Published September 26, 2026 · Last reviewed

Source: AI TechDoc Knowledge editorial definition, based on common embedded programming practice

Definitions follow the cited standards and specifications. Where a source is a copyrighted publication, such as an ISO, IEC or EN standard, the definition is a close paraphrase, not a verbatim quotation, so as not to infringe copyright. We recommend reading the original publication. The sections “How it applies” are editorial commentary by AI TechDoc Knowledge and are not part of any standard.

Seen a mistake? Send us a note!