#include <ThreadLocalHolder.h>
template<class T>
ThreadLocalHolder class
A thread-local storage wrapper.
Contents
This container is implemented as a wrapper for a concurrent map keyed by std thread ID. It is thus fully thread-safe (in theory).
This container is non-owning. It doesn't clean up memory. For a corresponding container which owns its objects, see ThreadLocalOwner.
Derived classes
-
template<class T>class ThreadLocalOwner
- A ThreadLocalHolder which owns its objects.
Public types
Public functions
- auto get() -> T*
- Get the object of the current thread.
- void set(T* obj)
- Assign the object of the current thread.
-
auto getMap() const -> const ThreadMap_
t& - Constant access for iteration, etc.
Protected variables
-
ThreadMap_
t m_threadMap - The wrapped thread-local storage container.