diff options
| author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-02-25 16:16:42 +0100 |
|---|---|---|
| committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-02-26 06:25:20 +0100 |
| commit | 23c5fc1d2fa9d9ff51129280288d13c935105b10 (patch) | |
| tree | 176188935ec3473af15b0a38883cd475a01b9de4 /src/corelib/thread/qrunnable.cpp | |
| parent | 165d2f09cd9a7f8a17da430846cbeb9dc51f55be (diff) | |
Improve argument name for std::function argument
Less \a fun though.
Note using references in this API would just duplicate the API, but
still end up with a copy when creating the QRunnable. By having the
copy apparent directly in the API, we not only save the duplication,
we also hint to the caller to use move if they want to avoid a copy.
Change-Id: If11476d4b38853839c1e87e0339807a1798fc875
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qrunnable.cpp')
| -rw-r--r-- | src/corelib/thread/qrunnable.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/thread/qrunnable.cpp b/src/corelib/thread/qrunnable.cpp index 58a764d4072..c911cd07455 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 |
