reentrant

From SEGGER Wiki
Jump to: navigation, search

A subroutine is called reentrant if can be called from an other thread of execution (an other task) or and Interrupt service routine during execution without problems. Typically, this means that the routine does not use any static variables. Routines which use only parameters and local variables are reentrant.

Calling conventions of most modern processors store parameters in registers and on the stack, which is basically required for a routine to be reentrant. Some compilers for older architectures (especially for 8-bit architectures such as 8051 and 6502) do not produce reentrant code and use a static overlay scheme instead.