Re-entrant is the fundamental property to thread safety, by definition, leads to thread safety.
Re-entrant function: (all by myself)
- Must hold no static (or global) non-constant data.
- Must not return the address to static (or global) non-constant data. Must work only on the data provided to it by the caller.
- Must not rely on locks to singleton resources.
- Must not modify its own code. (unless executing in its own unique thread storage)
- Must not call non-reentrant computer programs or routines.
Synchronize -- protect critical resource from all concurrent threads