Chapter 8. TSD
APIs Used in this Chapter
The Class java.lang.ThreadLocal
In which explanations of thread-specific data, their use, and some implementation details are provided.
Sometimes it is useful to have data that is globally accessible to any function, yet still unique to the thread. Two threads that are printing out data, one in French and the other in Danish, would find it most convenient to have a private global variable, which they could set to the desired language. Any function at any depth could then access this variable without the hassle of passing it at every call.
TSD provides this kind of global data by means of a set of function calls. The techniques used by POSIX and Java provide the ...