Thread-Safe Functions
Not all functions can be called from threads (e.g. strtok())
- many use global/static variables
- new versions of UNIX have thread-safe replacements, like strtok_r()
Safe:
- ctime_r(), gmtime_r(), localtime_r(), rand_r(), strtok_r()
Not Safe:
- ctime(), gmtime(), localtime(), rand(), strtok(), gethostXXX(), inet_toa()
could use semaphores to protect access