Monday, August 13, 2007

Re-entrant Code

* Re-entrant Code
Re-entrant code could be used by multi-thread and the result is only dependent upon input parameters. Re-entrant code is thread safe but thread safe might not re-entrant since the state of code might change due to global states. Re-entrant functions are similar to those of functional programming.

* Non Re-entrant Code
- Uses non-const global variables
- Uses static global/local variables
- Calls non re-entrant functions, like malloc, free, printf, fopen, and other I/O std functions

No comments: