summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-06-22 11:06:12 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-06-25 22:30:59 +0200
commit0475460102411979ab51c365cb2bec2c05b69cb4 (patch)
tree73b7dbe85249da2bd339cd19b0c584894d3901c7 /src/corelib/thread
parente114e580e751b5deb19ab489a8b11f830ff6356f (diff)
Use QList instead of QVector in corelib
Applied to headers only. Source file to be changed separately. Omitted statemachine for now to avoid conflicts. Omitted qmetatype.h for now - to be handled later. Task-number: QTBUG-84469 Change-Id: I317376037a62467c313467d92955ad0b7473aa97 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qfutureinterface.h8
-rw-r--r--src/corelib/thread/qresultstore.h22
-rw-r--r--src/corelib/thread/qthread_p.h12
-rw-r--r--src/corelib/thread/qthreadpool_p.h2
4 files changed, 20 insertions, 24 deletions
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index 75c4cae0ca..2e15cbb013 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -237,7 +237,7 @@ public:
inline void reportAndMoveResult(T &&result, int index = -1);
inline void reportResult(T &&result, int index = -1);
inline void reportResult(const T &result, int index = -1);
- inline void reportResults(const QVector<T> &results, int beginIndex = -1, int count = -1);
+ inline void reportResults(const QList<T> &results, int beginIndex = -1, int count = -1);
inline void reportFinished(const T *result);
void reportFinished()
{
@@ -300,8 +300,8 @@ inline void QFutureInterface<T>::reportResult(const T &result, int index)
reportResult(&result, index);
}
-template <typename T>
-inline void QFutureInterface<T>::reportResults(const QVector<T> &_results, int beginIndex, int count)
+template<typename T>
+inline void QFutureInterface<T>::reportResults(const QList<T> &_results, int beginIndex, int count)
{
std::lock_guard<QMutex> locker{mutex()};
if (this->queryState(Canceled) || this->queryState(Finished)) {
@@ -418,7 +418,7 @@ public:
inline QFuture<void> future(); // implemented in qfuture.h
void reportResult(const void *, int) { }
- void reportResults(const QVector<void> &, int) { }
+ void reportResults(const QList<void> &, int) { }
void reportFinished(const void * = nullptr)
{
QFutureInterfaceBase::reportFinished();
diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h
index c150876e74..523c745a8e 100644
--- a/src/corelib/thread/qresultstore.h
+++ b/src/corelib/thread/qresultstore.h
@@ -49,16 +49,14 @@ QT_REQUIRE_CONFIG(future);
QT_BEGIN_NAMESPACE
-
/*
ResultStore stores indexed results. Results can be added and retrieved
- either individually batched in a QVector. Retriveing results and checking
+ either individually batched in a QList. Retriveing results and checking
which indexes are in the store can be done either by iterating or by random
accees. In addition results kan be removed from the front of the store,
either individually or in batches.
*/
-
namespace QtPrivate {
class ResultItem
@@ -116,7 +114,7 @@ public:
const T *pointer() const
{
if (mapIterator.value().isVector())
- return &(reinterpret_cast<const QVector<T> *>(mapIterator.value().result)->at(m_vectorIndex));
+ return &(reinterpret_cast<const QList<T> *>(mapIterator.value().result)->at(m_vectorIndex));
else
return reinterpret_cast<const T *>(mapIterator.value().result);
}
@@ -169,19 +167,19 @@ public:
return addResult(index, static_cast<void *>(new T(std::move_if_noexcept(result))));
}
- template <typename T>
- int addResults(int index, const QVector<T> *results)
+ template<typename T>
+ int addResults(int index, const QList<T> *results)
{
- return addResults(index, new QVector<T>(*results), results->count(), results->count());
+ return addResults(index, new QList<T>(*results), results->count(), results->count());
}
- template <typename T>
- int addResults(int index, const QVector<T> *results, int totalCount)
+ template<typename T>
+ int addResults(int index, const QList<T> *results, int totalCount)
{
if (m_filterMode == true && results->count() != totalCount && 0 == results->count())
return addResults(index, nullptr, 0, totalCount);
- return addResults(index, new QVector<T>(*results), results->count(), totalCount);
+ return addResults(index, new QList<T>(*results), results->count(), totalCount);
}
int addCanceledResult(int index)
@@ -192,7 +190,7 @@ public:
template <typename T>
int addCanceledResults(int index, int _count)
{
- QVector<T> empty;
+ QList<T> empty;
return addResults(index, &empty, _count);
}
@@ -202,7 +200,7 @@ public:
QMap<int, ResultItem>::const_iterator mapIterator = m_results.constBegin();
while (mapIterator != m_results.constEnd()) {
if (mapIterator.value().isVector())
- delete reinterpret_cast<const QVector<T> *>(mapIterator.value().result);
+ delete reinterpret_cast<const QList<T> *>(mapIterator.value().result);
else
delete reinterpret_cast<const T *>(mapIterator.value().result);
++mapIterator;
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index 9255b05104..c853bd1de4 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -94,7 +94,7 @@ inline bool operator<(const QPostEvent &first, const QPostEvent &second)
// This class holds the list of posted events.
// The list has to be kept sorted by priority
-class QPostEventList : public QVector<QPostEvent>
+class QPostEventList : public QList<QPostEvent>
{
public:
// recursion == recursion count for sendPostedEvents()
@@ -107,9 +107,7 @@ public:
QMutex mutex;
- inline QPostEventList()
- : QVector<QPostEvent>(), recursion(0), startOffset(0), insertionOffset(0)
- { }
+ inline QPostEventList() : QList<QPostEvent>(), recursion(0), startOffset(0), insertionOffset(0) { }
void addEvent(const QPostEvent &ev) {
int priority = ev.priority;
@@ -129,8 +127,8 @@ public:
}
private:
//hides because they do not keep that list sorted. addEvent must be used
- using QVector<QPostEvent>::append;
- using QVector<QPostEvent>::insert;
+ using QList<QPostEvent>::append;
+ using QList<QPostEvent>::insert;
};
#if QT_CONFIG(thread)
@@ -292,7 +290,7 @@ public:
QAtomicPointer<QThread> thread;
QAtomicPointer<void> threadId;
QAtomicPointer<QAbstractEventDispatcher> eventDispatcher;
- QVector<void *> tls;
+ QList<void *> tls;
FlaggedDebugSignatures flaggedSignatures;
bool quitNow;
diff --git a/src/corelib/thread/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h
index 01852d8366..f019b480f5 100644
--- a/src/corelib/thread/qthreadpool_p.h
+++ b/src/corelib/thread/qthreadpool_p.h
@@ -174,7 +174,7 @@ public:
QSet<QThreadPoolThread *> allThreads;
QQueue<QThreadPoolThread *> waitingThreads;
QQueue<QThreadPoolThread *> expiredThreads;
- QVector<QueuePage*> queue;
+ QList<QueuePage *> queue;
QWaitCondition noActiveThreads;
int expiryTimeout = 30000;