Thread-scoped functions are functions that execute independently
on each thread without sharing intermediate state information across
threads. For example,
strtok() preserves pointers to tokens independently
on each thread, regardless of the fact that multiple threads may be
examining the same string in a
strtok() operation. Some examples
of thread-scoped functions are:
- strtok()
- rand(), srand()
- mblen(), mbtowc()
- strerror()
- asctime(), ctime(), gmtime(), localtime()
- clock()
The following are examples of process-scoped functions, which means
that a call to these functions on one thread influences the results
of calls to the same function on another thread. For example,
tmpnam() is
required to return a unique name for every invocation during the life
of the process, regardless of which thread issues the call.
- tmpnam()
- getenv()
- setenv()
- clearenv()
- putenv()