18 #ifndef LUNCHBOX_PERTHREAD_H
19 #define LUNCHBOX_PERTHREAD_H
21 #include <lunchbox/compiler.h>
22 #include <lunchbox/debug.h>
23 #include <lunchbox/tls.h>
27 namespace detail {
class PerThread; }
46 template<
class T,
void (*D)( T* ) = &perThreadDelete< T > >
71 { LBASSERTINFO(
get(),
className(
this ));
return *
get(); }
74 { LBASSERTINFO(
get(),
className(
this ));
return *
get(); }
81 {
return (
get() == rhs.
get( )); }
87 bool operator == (
const T* rhs )
const {
return (
get()==rhs ); }
93 bool operator != (
const T* rhs )
const {
return (
get()!=rhs ); }
113 #include "perThread.ipp"
115 #endif //LUNCHBOX_PERTHREAD_H
PerThread()
Construct a new per-thread variable.
const T & operator*() const
void perThreadNoDelete(T *)
Empty PerThread destructor.
std::string className(const T *object)
Print the RTTI name of the given class.
PerThread< T, D > & operator=(const T *data)
Assign an object to the thread-local storage.
bool operator!=(const T *rhs) const
~PerThread()
Destruct the per-thread variable.
Implements thread-specific storage for C++ objects.
bool operator==(const PerThread &rhs) const
T * operator->()
Access the thread-local object.
Abstraction layer and common utilities for multi-threaded programming.
Provides thread-local storage API used by PerThread and PerThreadRef.
void perThreadDelete(T *object)
Default PerThread destructor deleting the object.