Thread-Specific Storage for C/C++: An Object Behavioral Pattern for Accessing per-Thread State Efficiently
By: D.C. Schmidt, T.H. Harrison, N. Pryce
Summary: Allow multiple threads to use one logically global access point to retrieve thread-specific data without incurring locking overhead for each access.
Pattern: Thread-Specific Storage
Allow multiple threads to use one logically global access point to retrieve thread-specific data without incurring locking overhead for each access.
- Objects implemented with this pattern are often used as a per-thread Singleton [Gamma+95]
- Proxy [Gamma+95] can shield the libraries, frameworks, and applications from the implementation of thread-specific storage provided by OS thread libraries.
- Double-Checked Locking is commonly used by applications that employ Thread-Specific Storage to avoid constraining the order of initialization for thread-specific storage keys.
Published in: C++ Report, Nov./Dec. 1997
Pages: 33-47, 52
Category: Behavioral, Concurrent Systems
Url: http://www.cs.wustl.edu/~schmidt/patterns-ace.html