18 #ifndef LUNCHBOX_PERTHREADREF_H 19 #define LUNCHBOX_PERTHREADREF_H 21 #include <lunchbox/tls.h> 70 return (
get() == rhs.
get());
105 template <
typename T>
112 template <
typename T>
118 tls_.
set(static_cast<const void*>(data.
get()));
124 template <
typename T>
131 tls_.
set(rhs.tls_.get());
137 template <
typename T>
140 return static_cast<const T*
>(tls_.
get());
143 template <
typename T>
146 return static_cast<T*
>(tls_.
get());
149 template <
typename T>
152 return static_cast<T*
>(tls_.
get());
155 template <
typename T>
158 LBASSERT(tls_.
get());
159 return static_cast<T*
>(tls_.
get());
162 template <
typename T>
165 LBASSERT(tls_.
get());
166 return static_cast<const T*
>(tls_.
get());
169 template <
typename T>
172 return tls_.
get() == 0;
175 template <
typename T>
178 return tls_.
get() != 0;
181 #endif // LUNCHBOX_PERTHREADREF_H
~PerThreadRef()
Destruct a per-thread RefPtr.
bool operator!=(const RefPtr< T > &rhs) const
PerThreadRef< T > & operator=(RefPtr< T > data)
Assign a RefPtr to the thread-local storage.
void set(const void *data)
Set the data for this thread-local storage.
Abstraction layer and common utilities for multi-threaded programming.
bool operator==(const RefPtr< T > &rhs) const
A smart reference pointer, aka boost::intrusive_ptr.
Thread-specific storage for a RefPtr.
RefPtr< const T > get() const
Provides thread-local storage API used by PerThread and PerThreadRef.
PerThreadRef()
Construct a new per-thread RefPtr.
bool operator==(const PerThreadRef &rhs) const