Popular Posts

Thursday, July 14, 2011

What It Means to be Reentrant

If we want to make our code thread-safe and re-entrant we should not use static or global variables in our function.

In order for a a subroutine to be reentrant it must:
1. Hold no global non-constant data.
2. Not return the address of global non-constant data.
3. Work only on the data provided to it by the caller.
4. Not rely on locks to singleton resources.
5. Not modify its own code.
6. Not call non-reentrant computer programs or subroutines.

No comments:

Post a Comment