42 #ifndef QTHREADSTORAGE_H 43 #define QTHREADSTORAGE_H 45 #include <QtCore/qglobal.h> 58 explicit QThreadStorageData(
void (*func)(
void *));
59 ~QThreadStorageData();
64 static void finish(
void**);
68 #if !defined(QT_MOC_CPP) 78 return *(
reinterpret_cast<T**
>(v));
86 return v ? *(
reinterpret_cast<T**
>(v)) : 0;
97 {
delete static_cast<T *
>(
d); }
100 template <
typename T>
105 if (!v) v = d.
set(
new T());
106 return *(
reinterpret_cast<T*
>(*v));
109 template <
typename T>
114 return v ? *(
reinterpret_cast<T*
>(*v)) : T();
117 template <
typename T>
120 { (void) d.
set(
new T(*t)); }
122 template <
typename T>
125 {
delete static_cast<T *
>(
d); }
147 {
return d.
get() != 0; }
162 #endif // QT_NO_THREAD 164 #endif // QTHREADSTORAGE_H
T *& qThreadStorage_localData(QThreadStorageData &d, T **)
#define QT_END_NAMESPACE
This macro expands to.
static void deleteData(void *x)
T localData() const
Returns a copy of the data that was set by the calling thread.
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
#define QT_BEGIN_NAMESPACE
This macro expands to.
T & localData()
Returns a reference to the data that was set by the calling thread.
bool hasLocalData() const
If T is a pointer type, returns true if the calling thread has non-zero data available.
void setLocalData(T t)
Sets the local data for the calling thread to data.
~QThreadStorage()
Destroys the per-thread data storage object.
void qThreadStorage_setLocalData(QThreadStorageData &d, T **t)
QThreadStorage()
Constructs a new per-thread data storage object.
void qThreadStorage_deleteData(void *d, T **)
T * qThreadStorage_localData_const(const QThreadStorageData &d, T **)
The QThreadStorage class provides per-thread data storage.