diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/thread/qrunnable.cpp | 12 | ||||
-rw-r--r-- | src/corelib/thread/qrunnable.h | 2 | ||||
-rw-r--r-- | src/corelib/thread/qthreadpool.cpp | 20 | ||||
-rw-r--r-- | src/corelib/thread/qthreadpool.h | 4 |
4 files changed, 19 insertions, 19 deletions
diff --git a/src/corelib/thread/qrunnable.cpp b/src/corelib/thread/qrunnable.cpp index 58a764d407..c911cd0745 100644 --- a/src/corelib/thread/qrunnable.cpp +++ b/src/corelib/thread/qrunnable.cpp @@ -116,29 +116,29 @@ QRunnable::~QRunnable() class FunctionRunnable : public QRunnable { - std::function<void()> m_functor; + std::function<void()> m_functionToRun; public: - FunctionRunnable(std::function<void()> functor) : m_functor(std::move(functor)) + FunctionRunnable(std::function<void()> functionToRun) : m_functionToRun(std::move(functionToRun)) { } void run() override { - m_functor(); + m_functionToRun(); } }; /*! \since 5.15 - Creates a QRunnable that calls \a fun in run(). + Creates a QRunnable that calls \a functionToRun in run(). Auto-deletion is enabled by default. \sa run(), autoDelete() */ -QRunnable *QRunnable::create(std::function<void()> fun) +QRunnable *QRunnable::create(std::function<void()> functionToRun) { - return new FunctionRunnable(std::move(fun)); + return new FunctionRunnable(std::move(functionToRun)); } QT_END_NAMESPACE diff --git a/src/corelib/thread/qrunnable.h b/src/corelib/thread/qrunnable.h index c13aa3fa8c..26b6b991ac 100644 --- a/src/corelib/thread/qrunnable.h +++ b/src/corelib/thread/qrunnable.h @@ -60,7 +60,7 @@ public: QRunnable() : ref(0) { } virtual ~QRunnable(); - static QRunnable *create(std::function<void()> fun); + static QRunnable *create(std::function<void()> functionToRun); bool autoDelete() const { return ref != -1; } void setAutoDelete(bool _autoDelete) { ref = _autoDelete ? 0 : -1; } diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index d1875a69a9..a9352c3894 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -515,16 +515,16 @@ void QThreadPool::start(QRunnable *runnable, int priority) \overload \since 5.15 - Reserves a thread and uses it to run \a fun, unless this thread will + Reserves a thread and uses it to run \a functionToRun, unless this thread will make the current thread count exceed maxThreadCount(). In that case, - \a fun is added to a run queue instead. The \a priority argument can + \a functionToRun is added to a run queue instead. The \a priority argument can be used to control the run queue's order of execution. */ -void QThreadPool::start(std::function<void()> fun, int priority) +void QThreadPool::start(std::function<void()> functionToRun, int priority) { - if (!fun) + if (!functionToRun) return; - start(QRunnable::create(std::move(fun)), priority); + start(QRunnable::create(std::move(functionToRun)), priority); } /*! @@ -561,17 +561,17 @@ bool QThreadPool::tryStart(QRunnable *runnable) /*! \overload \since 5.15 - Attempts to reserve a thread to run \a fun. + Attempts to reserve a thread to run \a functionToRun. If no threads are available at the time of calling, then this function - does nothing and returns \c false. Otherwise, \a fun is run immediately + does nothing and returns \c false. Otherwise, \a functionToRun is run immediately using one available thread and this function returns \c true. */ -bool QThreadPool::tryStart(std::function<void()> fun) +bool QThreadPool::tryStart(std::function<void()> functionToRun) { - if (!fun) + if (!functionToRun) return false; - return tryStart(QRunnable::create(std::move(fun))); + return tryStart(QRunnable::create(std::move(functionToRun))); } /*! \property QThreadPool::expiryTimeout diff --git a/src/corelib/thread/qthreadpool.h b/src/corelib/thread/qthreadpool.h index 2eede44eca..e3691ab010 100644 --- a/src/corelib/thread/qthreadpool.h +++ b/src/corelib/thread/qthreadpool.h @@ -72,8 +72,8 @@ public: void start(QRunnable *runnable, int priority = 0); bool tryStart(QRunnable *runnable); - void start(std::function<void()> fun, int priority = 0); - bool tryStart(std::function<void()> fun); + void start(std::function<void()> functionToRun, int priority = 0); + bool tryStart(std::function<void()> functionToRun); int expiryTimeout() const; void setExpiryTimeout(int expiryTimeout); |