change runnable to lambda

This commit is contained in:
王劲鹏
2021-01-28 19:44:06 +08:00
committed by osborn
parent 1592dcb739
commit 21b3353e18
3 changed files with 11 additions and 16 deletions

View File

@@ -2,13 +2,14 @@
#define ASYNC_CALL_H
#include <QThreadPool>
#include <QtConcurrent/QtConcurrent>
class AsyncCall {
public:
static void ensureRunInThreadPool(QThreadPool &threadPool, QRunnable *runnable)
static void ensureRunInThreadPool(QThreadPool *threadPool, std::function<void()> lambda)
{
threadPool.start(runnable);
QtConcurrent::run(threadPool, lambda);
}
};