Check out my first novel, midnight's simulacra!
Thread-Local Storage: Difference between revisions
From dankwiki
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
==[[C|C99]]== | |||
* ISO/IEC 9899:1999 is amended by [[gcc]] and others to introduce the <tt>__thread</tt> storage specifier (§6.2.4, §6.4.1, §6.7.1), and to add a vague definition of threads to the execution model (§5.1.2). | |||
===C++11=== | |||
* C++11 adds the <tt>thread_local</tt> keyword | |||
** Only constant initializers can be used for variables having __thread storage. | |||
==Windows== | ==Windows== | ||
* <tt>__declspec(thread)</tt> doesn't work in DLL's prior to Vista | * <tt>__declspec(thread)</tt> doesn't work in DLL's prior to Vista when loaded via LoadLibrary(). | ||
** The DLL must be linked into the binary before the binary's main image is loaded. | |||
==See Also== | ==See Also== |
Revision as of 14:39, 6 September 2011
C99
- ISO/IEC 9899:1999 is amended by gcc and others to introduce the __thread storage specifier (§6.2.4, §6.4.1, §6.7.1), and to add a vague definition of threads to the execution model (§5.1.2).
C++11
- C++11 adds the thread_local keyword
- Only constant initializers can be used for variables having __thread storage.
Windows
- __declspec(thread) doesn't work in DLL's prior to Vista when loaded via LoadLibrary().
- The DLL must be linked into the binary before the binary's main image is loaded.
See Also
- pthreads
- Ulrich Drepper's paper, "ELF Handling for Thread-Local Storage"
- gcc's Info entry for TLS