This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/doric/async/async_call.h

17 lines
310 B
C
Raw Normal View History

2021-01-28 17:06:40 +08:00
#ifndef ASYNC_CALL_H
#define ASYNC_CALL_H
#include <QThreadPool>
2021-01-28 19:44:06 +08:00
#include <QtConcurrent/QtConcurrent>
2021-01-28 17:06:40 +08:00
class AsyncCall {
public:
2021-01-28 19:44:06 +08:00
static void ensureRunInThreadPool(QThreadPool *threadPool, std::function<void()> lambda)
2021-01-28 17:06:40 +08:00
{
2021-01-28 19:44:06 +08:00
QtConcurrent::run(threadPool, lambda);
2021-01-28 17:06:40 +08:00
}
};
#endif // ASYNC_CALL_H