TLS on Other Platforms


Java has no explicit support for TLS, but you can provide the same functionality by deriving a new class from Thread that contains a static hash map. You can then derive your thread classes from this hash-map container and use Thread.currentThread to store and retrieve local storage data through the hash map.

Most platforms support POSIX (Portable Operating System Interface based on uniX). POSIX [4] provides the same functionality as static TLS (see sidebar, “Static vs. Dynamic TLS”) under Windows through the pthread_key set of functions.