Reentrancy usually refers to subroutines, functions, methods and mutexes. A subroutine is considered reentrant if it can be safely called before a previous call has completed.
To be reentrant a subroutine, function, method etc must:
- hold no static (or global) non-constant data
- not return the address to static (or global) non-constant data
- work only on the data provided to it by the caller
- not rely on locks to singleton resources
A reentrant mutex's lock can be acquired multiple times by the same thread. However, the lock must be released the same number of times or else other threads will be unable to acquire the lock. It has some similarities to a counting semaphore. More info here: Reentrant mutex
See also