ATLAS Offline Software
Classes | Namespaces
ThreadLocalHolder.h File Reference

Defines template helper classes for thread-local storage. More...

#include <thread>
#include <utility>
#include "tbb/concurrent_unordered_map.h"
Include dependency graph for ThreadLocalHolder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  thread_utils::ThreadLocalHolder< T >
 A thread-local storage wrapper. More...
 
class  thread_utils::ThreadLocalOwner< T >
 A ThreadLocalHolder which owns its objects. More...
 

Namespaces

 thread_utils
 

Detailed Description

Defines template helper classes for thread-local storage.

The helpers here provide an implementation of thread-local storage which allows for non-static dynamic memory management as well as element iteration. This extra functionality makes these containers much slower than the builtin thread_local and should only be used when needed.

Todo:
Should we optimize these implementations for non-MT environments? One could alternatively just optimze the clients where necessary. I could replace these classes with a simple pointer wrapper if ATHENAHIVE and G4MULTITHREADED are not defined, but the map iteration functionality would need an awkward implementation.

Definition in file ThreadLocalHolder.h.