18 #ifndef LUNCHBOX_PERTHREAD_H
19 #define LUNCHBOX_PERTHREAD_H
21 #include <lunchbox/compiler.h>
22 #include <lunchbox/tls.h>
26 namespace detail {
class PerThread; }
45 template<
class T,
void (*D)( T* ) = &perThreadDelete< T > >
70 { LBASSERTINFO(
get(),
className(
this ));
return *
get(); }
73 { LBASSERTINFO(
get(),
className(
this ));
return *
get(); }
80 {
return (
get() == rhs.
get( )); }
86 bool operator == (
const T* rhs )
const {
return (
get()==rhs ); }
92 bool operator != (
const T* rhs )
const {
return (
get()!=rhs ); }
112 #include "perThread.ipp"
114 #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.