diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-20 11:03:48 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-21 08:53:38 +0200 |
commit | 1be271713ebcbca2f2cc1dd8734f2740165dab96 (patch) | |
tree | f39c4c241bae383427d466e6225889ab3e91efea /src/corelib/thread/qthreadpool_p.h | |
parent | 3e09ac369dc8e2851ff772b9d9dde92fffd959b2 (diff) |
Whitespace cleanup in corelib/ mimetypes, plugin and thread
Done with selective application of clang-format
Change-Id: Iee6bf2426de81356b6d480629ba972f980b6d93d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qthreadpool_p.h')
-rw-r--r-- | src/corelib/thread/qthreadpool_p.h | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/corelib/thread/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h index f019b480f5..4d73a480b5 100644 --- a/src/corelib/thread/qthreadpool_p.h +++ b/src/corelib/thread/qthreadpool_p.h @@ -65,47 +65,44 @@ QT_BEGIN_NAMESPACE class QDeadlineTimer; -class QueuePage { +class QueuePage +{ public: enum { MaxPageSize = 256 }; - QueuePage(QRunnable *runnable, int pri) - : m_priority(pri) - { - push(runnable); - } + QueuePage(QRunnable *runnable, int pri) : m_priority(pri) { push(runnable); } - bool isFull() { - return m_lastIndex >= MaxPageSize - 1; - } + bool isFull() { return m_lastIndex >= MaxPageSize - 1; } - bool isFinished() { - return m_firstIndex > m_lastIndex; - } + bool isFinished() { return m_firstIndex > m_lastIndex; } - void push(QRunnable *runnable) { + void push(QRunnable *runnable) + { Q_ASSERT(runnable != nullptr); Q_ASSERT(!isFull()); m_lastIndex += 1; m_entries[m_lastIndex] = runnable; } - void skipToNextOrEnd() { + void skipToNextOrEnd() + { while (!isFinished() && m_entries[m_firstIndex] == nullptr) { m_firstIndex += 1; } } - QRunnable *first() { + QRunnable *first() + { Q_ASSERT(!isFinished()); QRunnable *runnable = m_entries[m_firstIndex]; Q_ASSERT(runnable); return runnable; } - QRunnable *pop() { + QRunnable *pop() + { Q_ASSERT(!isFinished()); QRunnable *runnable = first(); Q_ASSERT(runnable); @@ -120,7 +117,8 @@ public: return runnable; } - bool tryTake(QRunnable *runnable) { + bool tryTake(QRunnable *runnable) + { Q_ASSERT(!isFinished()); for (int i = m_firstIndex; i <= m_lastIndex; i++) { if (m_entries[i] == runnable) { @@ -135,9 +133,7 @@ public: return false; } - int priority() const { - return m_priority; - } + int priority() const { return m_priority; } private: int m_priority = 0; |