A piece of code is reentrant if, while it is being executed, it can
be re-invoked by itself, or by any other routine, by interrupting
the present execution for a while.
must satisfy conditions for 'reentrancy' of a code:
- It never modifies itself. That is, the instructions of the
program are never changed. Period. Under any circumstances.
- Any variables changed by the routine must be allocated to
a particular "instance" of the function's invocation. so if a function is called from three different threads then its data should get stored in three different areas of memory.
(by avoiding global/static data access)