Added preprocessor defines to do re-entrancy checks only in debug mode