#include <qthreadstorage.h>
Definition at line 55 of file qthreadstorage.h.
◆ QThreadStorageData()
QThreadStorageData::QThreadStorageData |
( |
void(*)(void *) |
func | ) |
|
|
explicit |
Definition at line 78 of file qthreadstorage.cpp.
93 id = data->
tls.count();
94 DEBUG_MSG(
"QThreadStorageData: Allocated id %d, destructor %p cannot be stored",
id, func);
97 for (
id = 0;
id < destr->
count();
id++) {
98 if (destr->
at(
id) == 0)
101 if (
id == destr->
count()) {
106 DEBUG_MSG(
"QThreadStorageData: Allocated id %d, destructor %p",
id, func);
int count(const T &t) const
Returns the number of occurrences of value in the vector.
The QVector class is a template class that provides a dynamic array.
void append(const T &t)
Inserts value at the end of the vector.
static const char * data(const QByteArray &arr)
const T & at(int i) const
Returns the item at index position i in the vector.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
static QThreadData * current()
◆ ~QThreadStorageData()
QThreadStorageData::~QThreadStorageData |
( |
| ) |
|
Definition at line 109 of file qthreadstorage.cpp.
111 DEBUG_MSG(
"QThreadStorageData: Released id %d",
id);
114 (*destructors())[
id] = 0;
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
◆ finish()
void QThreadStorageData::finish |
( |
void ** |
p | ) |
|
|
static |
Definition at line 174 of file qthreadstorage.cpp.
Referenced by QThreadPrivate::finish(), and QCoreApplicationPrivate::~QCoreApplicationPrivate().
177 if (!tls || tls->isEmpty() || !mutex())
181 while (!tls->isEmpty()) {
182 void *&value = tls->last();
185 int i = tls->size() - 1;
194 void (*destructor)(
void *) = destructors()->value(i);
199 qWarning(
"QThreadStorage: Thread %p exited after QThreadStorage %d destroyed",
205 if (tls->size() > i) {
The QVector class is a template class that provides a dynamic array.
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
Q_CORE_EXPORT void qWarning(const char *,...)
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
QThreadStorage< QSharedNetworkSessionManager * > tls
◆ get()
void ** QThreadStorageData::get |
( |
| ) |
const |
◆ set()
void ** QThreadStorageData::set |
( |
void * |
p | ) |
|
Definition at line 137 of file qthreadstorage.cpp.
Referenced by qThreadStorage_localData().
141 qWarning(
"QThreadStorage::set: QThreadStorage can only be used with threads started with QThread");
145 if (tls.size() <=
id)
148 void *&value = tls[
id];
151 DEBUG_MSG(
"QThreadStorageData: Deleting previous storage %d, data %p, for thread %p",
158 void (*destructor)(
void *) = destr ? destr->
value(
id) : 0;
170 DEBUG_MSG(
"QThreadStorageData: Set storage %d for thread %p to %p",
id, data->
thread, p);
The QVector class is a template class that provides a dynamic array.
T value(int i) const
Returns the value at index position i in the vector.
Q_CORE_EXPORT void qWarning(const char *,...)
static const char * data(const QByteArray &arr)
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
static QThreadData * current()
QThreadStorage< QSharedNetworkSessionManager * > tls
◆ id
int QThreadStorageData::id |
The documentation for this class was generated from the following files: