TLS - feature differences (CrCh320)
The TLS features offered by the Tru64 UNIX and HP-UX operating system platforms are different.
Thread Local Storage (TLS) is data that is allocated to a specific thread for that thread's lifetime. TLS is not shared between threads and is treated as if each thread has its own copy of the data. TLS is not part of the POSIX IEEE 1003.1c standard; however, it is supported on both HP-UX 11i and Tru64 UNIX with the help of the platform compilers.
On Tru64 UNIX, TLS variables can be declared using the following, where __declspec(__thread) declares the xyz TLS variable:
__declspec(__thread) static int xyz;
The Tru64 UNIX compiler also accepts __declspec(thread) as a variant of __declspec(__thread).
On HP-UX, TLS variables can be declared using the following, where __thread declares the xyz TLS variable:
__thread int xyz;
The __declspec(__thread) functionality is being changed. As of the AR1204 compiler release, it will invoke the existing IPF ABI TLS model, which is described in the IA-64 TLS Supplement. For more information on the Tru64 UNIX TLS implementation, see Section 12.4.2 in the 5.1B version of the Tru64 UNIX Programmer's Guide.
Use the __thread keyword or wait until the AR1204 compiler release when the __declspec declaration is expected to become available on HP-UX.
The currently available compilers use the __thread keyword instead of the __declspec(__thread) keyword. Developers porting TLS applications before AR1204 is available will need to change their sources. As of AR1204, the compiler will accept all variants: __declspec(__thread), __declspec(thread), and __thread, and will invoke the IPF ABI TLS model described in the IA-64 TLS Supplement.
||any HP-UX 11i version